Replies: 1 comment
-
I think you are misunderstanding how the When used as a decorator, the When used as a regular method, you include the handler function in the call, so sio.on('message', my_message_handler, namespace='/chat') I reviewed the code again and it seems correct to me. Am I missing anything? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
While working on types for
BaseServer
'son()
, I noticed that the original implementation returnsNone
when used as a decorator.AFAIK, this is not the most common pattern: people might want to use the already-decorated value for decorating something else, only to find they can't. It also makes the types unnecessarily complex, over simply always returning the event handler callable.
Just to understand, I guess the
set_handler()
pattern allows for the following AFAIK undocumented behaviour:After this,
my_handler()
will have it's original value, just the hook was added tosio
's handler.In any other case, e.g. when
handler
is specified, it will callset_handler()
but not return it's return value. So:Why has this decision been made, should the last line read
return set_handler(handler)
?python-socketio/src/socketio/base_server.py
Line 127 in 8f0e66c
Related: python/typeshed#13095
Beta Was this translation helpful? Give feedback.
All reactions