mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
add websockets suppor3
This commit is contained in:
@@ -2,6 +2,7 @@ from fastapi import WebSocket
|
||||
from typing import Dict, List
|
||||
import json
|
||||
import logging
|
||||
import asyncio
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -58,4 +59,12 @@ class NotificationManager:
|
||||
for connection in disconnected:
|
||||
self.disconnect(connection, "employee")
|
||||
|
||||
async def handle_ping(self, websocket: WebSocket):
|
||||
"""Обработка ping сообщений"""
|
||||
try:
|
||||
await websocket.send_json({"type": "pong"})
|
||||
logger.debug("Sent pong response")
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending pong: {e}")
|
||||
|
||||
notification_manager = NotificationManager()
|
Reference in New Issue
Block a user