feat: webscoket
This commit is contained in:
14
backend/controller/ws.py
Normal file
14
backend/controller/ws.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.websockets import WebSocket
|
||||
|
||||
from core.utils import get_system_info
|
||||
|
||||
# websocket app
|
||||
ws_app = FastAPI()
|
||||
|
||||
|
||||
@ws_app.websocket("/ws")
|
||||
async def ws_func(ws: WebSocket):
|
||||
await ws.accept()
|
||||
while True:
|
||||
await ws.send_json(get_system_info())
|
Reference in New Issue
Block a user