feat: webscoket
This commit is contained in:
1 parent
29c6e368ae
commit
8da0127729
5 files changed
+33
No files matched your search
@@ -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