INNER CODE UNIT · Python
__init__
permitio/fastapi_websocket_pubsub · fastapi_websocket_pubsub/event_broadcaster.py:39
def __init__(
self,
event_broadcaster: "EventBroadcaster",
listen: bool = True,
share: bool = True,
) -> None:
"""
Provide a context manager for an EventBroadcaster, managing if it listens to events coming from the broadcaster
and if it subscribes to the internal notifier to share its events with the broadcaster
Args:
event_broadcaster (EventBroadcaster): the broadcaster we manage the context for.
share (bool, optional): Should we share events with the broadcaster. Defaults to True.
listen (bool, optional): Should we listen for incoming events from the broadcaster. Defaults to True.
"""
self._event_broadcaster = event_broadcaster
self._share: bool = share
self._listen: bool = listen