Authenticate user and register connection in CONNECTIONS.
(websocket)
| 30 | |
| 31 | |
| 32 | async def handler(websocket): |
| 33 | """Authenticate user and register connection in CONNECTIONS.""" |
| 34 | sesame = await websocket.recv() |
| 35 | user = await asyncio.to_thread(get_user, sesame) |
| 36 | if user is None: |
| 37 | await websocket.close(CloseCode.INTERNAL_ERROR, "authentication failed") |
| 38 | return |
| 39 | |
| 40 | ct_ids = await asyncio.to_thread(get_content_types, user) |
| 41 | CONNECTIONS[websocket] = {"content_type_ids": ct_ids} |
| 42 | try: |
| 43 | await websocket.wait_closed() |
| 44 | finally: |
| 45 | del CONNECTIONS[websocket] |
| 46 | |
| 47 | |
| 48 | async def process_events(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…