Изменение вебсокета

This commit is contained in:
urec56 2024-06-05 19:49:05 +05:00
parent 6103b60da1
commit b8c77bfae7

View file

@ -136,15 +136,15 @@ manager = ConnectionManager()
async def websocket_endpoint( async def websocket_endpoint(
chat_id: int, chat_id: int,
websocket: WebSocket, websocket: WebSocket,
authorization: Annotated[str | None, Header()] = None, sec_websocket_protocol: Annotated[str | None, Header()] = None,
# user: SUser = Depends(get_current_user_ws), # user: SUser = Depends(get_current_user_ws),
uow=Depends(UnitOfWork) uow=Depends(UnitOfWork)
): ):
# await AuthService.check_verificated_user_with_exc(uow=uow, user_id=user.id) # await AuthService.check_verificated_user_with_exc(uow=uow, user_id=user.id)
# await AuthService.validate_user_access_to_chat(uow=uow, user_id=user.id, chat_id=chat_id) # await AuthService.validate_user_access_to_chat(uow=uow, user_id=user.id, chat_id=chat_id)
await manager.connect(chat_id, websocket) await manager.connect(chat_id, websocket)
logging.critical(authorization) logging.critical(sec_websocket_protocol)
await websocket.send_json({"headers": str(websocket.headers), "authorization": authorization}) await websocket.send_json({"headers": str(websocket.headers), "authorization": sec_websocket_protocol})
try: try:
while True: while True:
data = await websocket.receive_json() data = await websocket.receive_json()