Hello Sanic Developers!
I’m trying to create a WebSocket communication with Sanic, but I do not want to receive data from a client, only send it. For example:
num = 1
def sum():
num = num + 1
return num
@app.websocket("/ws/state")
async def simulationSum_ws(request: Request, ws: Websocket):
while True:
await ws.send(str(sum()))
This method is blocking the Sanic for other routes, I have already tried to use Thread, but it is not working.
Does anyone have some idea that can help me?
Thank you.