> ## Documentation Index
> Fetch the complete documentation index at: https://abxbus.archivebox.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SocketEventBridge

> Forward events through Unix domain sockets.

`SocketEventBridge` uses a Unix socket path for both send and listen directions.

## Go support

<Tabs>
  <Tab title="Go">
    `SocketEventBridge` is not implemented in `abxbus-go` yet. Use [JSONLEventBridge](./bridge-jsonl) for the currently supported Go bridge.
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    // Not implemented in the Rust crate yet.
    // Use typed event JSON serialization with an external transport for now.
    ```
  </Tab>
</Tabs>

## Constructor params

* `path`: Unix socket path (absolute path recommended)
* `name`: optional bridge label

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from abxbus.bridges import SocketEventBridge

    bridge = SocketEventBridge('/tmp/abxbus_events.sock', name='SocketBridge')
    ```
  </Tab>

  <Tab title="TypeScript">
    ```ts theme={null}
    import { SocketEventBridge } from 'abxbus/bridges'

    const bridge = new SocketEventBridge('/tmp/abxbus_events.sock', 'SocketBridge')
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    // SocketEventBridge is not implemented in abxbus-go yet.
    // Use JSONLEventBridge for Go process-to-process bridge tests and deployments.
    ```
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    // Not implemented in the Rust crate yet.
    // Use typed events plus EventBus JSON serialization with an external transport for now.
    ```
  </Tab>
</Tabs>

## Setup with a bus

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from abxbus import EventBus
    from abxbus.bridges import SocketEventBridge

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

    bus.on('*', bridge.emit)
    bridge.on('*', bus.emit)
    ```
  </Tab>

  <Tab title="TypeScript">
    ```ts theme={null}
    import { EventBus } from 'abxbus'
    import { SocketEventBridge } from 'abxbus/bridges'

    const bus = new EventBus('AppBus')
    const bridge = new SocketEventBridge('/tmp/abxbus_events.sock')

    bus.on('*', bridge.emit)
    bridge.on('*', bus.emit)
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    // SocketEventBridge is not implemented in abxbus-go yet.
    // Use JSONLEventBridge for Go process-to-process bridge tests and deployments.
    ```
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    // Not implemented in the Rust crate yet.
    // Use typed events plus EventBus JSON serialization with an external transport for now.
    ```
  </Tab>
</Tabs>

## 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.
