Skip to content

blackbull.event_aggregator

blackbull.event_aggregator

Boundary from internal actor traffic to application events.

Keep application event names and detail shapes transport-independent. See docs/guide/events.md for the public contract.

EventAggregator

Translates Level A Actor messages into Level B EventDispatcher calls.

Not an Actor: one per application, passed to each Actor at construction and called from the event-loop thread. Each on_* method is one Level B event of the Events guide. Framework-internal: do not export it from blackbull/__init__.py.

on_connection_accepted(peername, protocol='http') async

Fire connection_accepted; protocol is 'http' on the shared HTTP listener (h1/h2 is not known at accept), else the registered name.

on_connection_closed(peername, protocol, duration_ms) async

Fire connection_closed.

on_error(conn, exception) async

Fire error; conn is a Connection, or a scope dict on the compat lane.

on_message_received(protocol, message_type, payload_size) async

Fire message_received (application-level message in).

on_message_sent(protocol, message_type, payload_size) async

Fire message_sent (application-level message out).

on_request_disconnected(conn) async

Fire Level B request_disconnected; conn is a Connection, or a scope dict on the compat lane.

on_websocket_connected(conn, subprotocol=None) async

Fire Level B websocket_connected (conn is a Connection).

on_websocket_disconnected(conn, code=1006, *, timeout=None) async

Emit websocket_disconnected; timeout follows EventDispatcher.emit.

on_websocket_message(conn, message) async

Emit websocket_message with conn/text/bytes detail when listeners exist.