You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It's possible to accept connections on any namespace by specifying namespaces='*' in either Server init, but you can't actually handle arbitrary namespaces: unless a namespace is explicitly defined by an event handler, any client packets using it will get silently dropped.
Describe the solution you'd like
Allow specifying an event handler with namespace='*' to be a catch-all handler in the absence of an explicit namespace match. In that case, the handler should also be given an explicit namespace parameter with the namespace from the client packet.
Additional context
Such a thing is already implemented for catch-all event handlers in the server's _trigger_event (e.g.
), so similar logic could probably be used at the namespace level as well.
This is could perhaps allow a high level approach to #1166 with less library overhead since there'd be no regex comparison (though it could nonetheless be done by a user if so desired).
The text was updated successfully, but these errors were encountered:
Yes, in principle I like this idea as it is consistent with previous work for event handlers. The event handlers attached to the catch all namespace will need to receive the namespace as an additional argument, so that they can implement logic that depends on which namespace the client used.
Would you like to give this idea a try and send a PR?
Is your feature request related to a problem? Please describe.
It's possible to accept connections on any namespace by specifying
namespaces='*'
in either Server init, but you can't actually handle arbitrary namespaces: unless a namespace is explicitly defined by an event handler, any client packets using it will get silently dropped.Describe the solution you'd like
Allow specifying an event handler with
namespace='*'
to be a catch-all handler in the absence of an explicit namespace match. In that case, the handler should also be given an explicitnamespace
parameter with the namespace from the client packet.Additional context
Such a thing is already implemented for catch-all event handlers in the server's
_trigger_event
(e.g.python-socketio/src/socketio/server.py
Lines 610 to 611 in 6967eca
This is could perhaps allow a high level approach to #1166 with less library overhead since there'd be no regex comparison (though it could nonetheless be done by a user if so desired).
The text was updated successfully, but these errors were encountered: