INNER CODE UNIT · Python
get_listening_context
permitio/fastapi_websocket_pubsub · fastapi_websocket_pubsub/event_broadcaster.py:210
def get_listening_context(self):
return EventBroadcasterContextManager(self, listen=True, share=False)
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):