Тест long polling
This commit is contained in:
parent
df3629138c
commit
22902048cd
1 changed files with 3 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import asyncio
|
||||
from collections import defaultdict
|
||||
|
||||
import websockets
|
||||
from fastapi import WebSocket, WebSocketDisconnect, Depends, HTTPException, status
|
||||
|
@ -158,8 +159,8 @@ async def chat_ws(
|
|||
|
||||
class PollingManager:
|
||||
def __init__(self):
|
||||
self.waiters: dict[int, list[asyncio.Future]] = {}
|
||||
self.messages: dict[int, list[dict]] = {}
|
||||
self.waiters: dict[int, list[asyncio.Future]] = defaultdict(list)
|
||||
self.messages: dict[int, list[dict]] = defaultdict(list)
|
||||
|
||||
async def poll(self, chat_id: int):
|
||||
future = asyncio.Future()
|
||||
|
|
Loading…
Add table
Reference in a new issue