INNER CODE UNIT · Python
get_sharing_context
permitio/fastapi_websocket_pubsub · fastapi_websocket_pubsub/event_broadcaster.py:213
def get_sharing_context(self):
return EventBroadcasterContextManager(self, listen=False, share=True)
async def __aenter__(self):
"""
Convince caller (also backward compaltability)
"""
if self._context_manager is None:
self._context_manager = self.get_context(listen=not self._is_publish_only)
return await self._context_manager.__aenter__()
async def __aexit__(self, exc_type, exc, tb):
await self._context_manager.__aexit__(exc_type, exc, tb)
async def start_reader_task(self):
"""Spawn a task reading incoming broadcasts and posting them to the intreal notifier
Raises:
BroadcasterAlreadyStarted: if called more than once per context