miguelgrinberg / flask-sock

Modern WebSocket support for Flask.
MIT License
272 stars 24 forks source link

Whether async is supported #47

Closed XiaoXinYo closed 1 year ago

XiaoXinYo commented 1 year ago

I add 'async' before the function header and run the prompt

@SOCK.route('/chat')
async def chat(ws):
    chatBot = livebot()
    while True:
        a = await chatBot.ask(ws.receive())
        print(a)
        ws.send(json.dumps(a))

RuntimeWarning: coroutine 'chat' was never waitedf(ws, *args, **kwargs)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback"
miguelgrinberg commented 1 year ago

No, async routes are not supported. Sorry.