inicia o projeto com traefik e uvicorn
This commit is contained in:
13
config/websocket.py
Normal file
13
config/websocket.py
Normal file
@ -0,0 +1,13 @@
|
||||
async def websocket_application(scope, receive, send):
|
||||
while True:
|
||||
event = await receive()
|
||||
|
||||
if event["type"] == "websocket.connect":
|
||||
await send({"type": "websocket.accept"})
|
||||
|
||||
if event["type"] == "websocket.disconnect":
|
||||
break
|
||||
|
||||
if event["type"] == "websocket.receive":
|
||||
if event["text"] == "ping":
|
||||
await send({"type": "websocket.send", "text": "pong!"})
|
||||
Reference in New Issue
Block a user