INNER CODE UNIT · Python
_subscribe_to_all_topics
permitio/fastapi_websocket_pubsub · fastapi_websocket_pubsub/event_broadcaster.py:189
async def _subscribe_to_all_topics(self):
return await self._notifier.subscribe(
self._id, ALL_TOPICS, self.__broadcast_notifications__
)
async def _unsubscribe_from_topics(self):
return await self._notifier.unsubscribe(self._id)
def get_context(self, listen=True, share=True):
"""
Create a new context manager you can call 'async with' on, configuring the broadcaster for listening, sharing, or both.
Args:
listen (bool, optional): Should we listen for events incoming from the broadcast channel. Defaults to True.
share (bool, optional): Should we share events with the broadcast channel. Defaults to True.
Returns:
EventBroadcasterContextManager: the context