We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requirements:
sanic==22.9.0 python-socketio==5.7.1
Code:
import sanic import socketio app = sanic.Sanic("app") @app.on_request async def print_urls(request): print(f'>>>> {request.url}') @app.route("/") async def handler(_): return sanic.response.html( '''<!doctype html> <html lang="en"> <head></head> <body> <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js"></script> <script> var socket = io({ path: "/socket.io/", transports: ["websocket"] }); </script> </body> </html>''') sio = socketio.AsyncServer(async_mode='sanic', logger=False, engineio_logger=False) sio.attach(app) @sio.event def connect(sid, *_): print(f'>> Connected Successfully: {sid}') @sio.event def disconnect(sid): print(f'>> Disconnected Successfully: {sid}') if __name__ == '__main__': app.run(access_log=False)
Error:
More: Problem occurs only after disconnection when websocket transport is used. Details in video. Everything else is working Perfectly.
websocket
The text was updated successfully, but these errors were encountered:
Old related issues:
#2105
Sorry, something went wrong.
I can try and take a look next week. Did you try as a hack to return a dummy response object from the disconnect callback?
I'll be honest, I have no clue how that is "attaching" to Sanic and plugging into the router for example 🤷♂️
I couldn't reproduce the issue with latest Sanic (main branch), latest python-socketio (5.11.2), and Python 3.11 on Linux.
main
python-socketio
5.11.2
I also can't reproduce the issue with latest Sanic (v24.6.0), latest python-socketio (5.11.3) and Python 3.11.8 on Windows. I believe this is fixed!
This is fixed and can be closed! See: miguelgrinberg/python-socketio@287d6ed
No branches or pull requests
Requirements:
Code:
Error:
Error.mp4
More:
Problem occurs only after disconnection when
websocket
transport is used. Details in video. Everything else is working Perfectly.The text was updated successfully, but these errors were encountered: