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

# HTTPEventBridge

> Forward events over HTTP(S) endpoints.

`HTTPEventBridge` forwards event JSON over HTTP and can optionally expose an inbound HTTP listener.

## Go support

<Tabs>
  <Tab title="Go">
    `HTTPEventBridge` 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

* `send_to`: optional outbound endpoint (`http://` or `https://`)
* `listen_on`: optional inbound endpoint (`http://` only)
* `name`: optional bridge label

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

    bridge = HTTPEventBridge(
        send_to='https://peer.example.com/abxbus_events',
        listen_on='http://0.0.0.0:8002/abxbus_events',
        name='HttpBridge',
    )
    ```
  </Tab>

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

    const bridge = new HTTPEventBridge({
      send_to: 'https://peer.example.com/abxbus_events',
      listen_on: 'http://0.0.0.0:8002/abxbus_events',
      name: 'HttpBridge',
    })
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    // HTTPEventBridge 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 HTTPEventBridge

    bus = EventBus('AppBus')
    bridge = HTTPEventBridge(
        send_to='https://peer.example.com/abxbus_events',
        listen_on='http://0.0.0.0:8002/abxbus_events',
    )

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

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

    const bus = new EventBus('AppBus')
    const bridge = new HTTPEventBridge({
      send_to: 'https://peer.example.com/abxbus_events',
      listen_on: 'http://0.0.0.0:8002/abxbus_events',
    })

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

  <Tab title="Go">
    ```go theme={null}
    // HTTPEventBridge 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(...)` serializes an event and sends a `POST` request to `send_to`.
* `on(...)` registers handlers on the bridge's internal inbound bus and auto-starts the listener when needed.
* Inbound payloads are parsed back into `BaseEvent`, reset to pending state, then emitted on the internal bus.
* `close()` shuts down listener/server resources and the internal bus.
* In TypeScript, listener mode (`listen_on`) is supported in Node.js runtimes.
