Skip to main content
SocketEventBridge uses a unix socket path for both send and listen directions.

Constructor params

  • path: unix socket path (absolute path recommended)
  • name: optional bridge label
from bubus import SocketEventBridge

bridge = SocketEventBridge('/tmp/bubus_events.sock', name='SocketBridge')

Setup with a bus

from bubus import EventBus, SocketEventBridge

bus = EventBus('AppBus')
bridge = SocketEventBridge('/tmp/bubus_events.sock')

bus.on('*', bridge.emit)
bridge.on('*', bus.emit)

Behavior

  • emit(...) writes newline-delimited event JSON frames to the unix socket.
  • on(...) subscribes handlers on the inbound side and auto-starts the socket listener.
  • Incoming frames are decoded into events, reset, then emitted on the internal bus.
  • close() stops the socket server and tears down the internal bus.
  • TypeScript socket bridges require Node.js runtime support for unix sockets.