INNER CODE UNIT · Python
EventBroadcasterContextManager
permitio/fastapi_websocket_pubsub · fastapi_websocket_pubsub/event_broadcaster.py:33
class EventBroadcasterContextManager:
"""
Manages the context for the EventBroadcaster
Friend-like class of EventBroadcaster (accessing "protected" members )
"""
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.