Skip to content
New issue

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

Support for timeout on emit #1431

Open
jmgoncalves opened this issue Jan 28, 2025 · 1 comment
Open

Support for timeout on emit #1431

jmgoncalves opened this issue Jan 28, 2025 · 1 comment
Assignees

Comments

@jmgoncalves
Copy link

jmgoncalves commented Jan 28, 2025

Is your feature request related to a problem? Please describe.
When using emit with callbacks if the other party frequently disconnects and misses events, the callbacks in base_manager.py (https://github.com/miguelgrinberg/python-socketio/blob/main/src/socketio/base_manager.py#L15) will just keep growing over time.

Describe the solution you'd like
Implement optional timeout on emit, as described here https://socket.io/docs/v4/emitting-events/#with-timeout

Describe alternatives you've considered
I can use call instead of emit but I have to wrap that in an async runtime...

@miguelgrinberg
Copy link
Owner

A call() is a pythonic version of the emit with timeout. If you don't want to block then you can run it in a background task.

But in any case, the accumulation of callbacks that never trigger should be addressed. I'll think about how to handle that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants