-
Notifications
You must be signed in to change notification settings - Fork 58
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
Added response callback to HubServer's invoke(). #29
base: develop
Are you sure you want to change the base?
Conversation
Would very much like to see this land. @u-abramchuk are you still using/maintaining this at all? |
callId = int(kwargs['I']) | ||
if callId in self.__rspHandlers: | ||
rspArgs = kwargs['R'] if 'R' in kwargs else {} | ||
rspHandlers[callId](**rspArgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the reply is, in the general case, just a single value that should be passed directly to the function as a single parameter, not unfurled as kwargs. ie:
rspArg = kwargs['R'] if 'R' in kwargs else None
rspHandlers[callId](rspArgs)
As it stands today, I'm getting errors from methods that don't return dicts:
Traceback (most recent call last):
File "/home/gabriel/repos/coinbot/env/local/lib/python2.7/site-packages/gevent/greenlet.py", line 536, in run
result = self._run(*self.args, **self.kwargs)
File "/home/gabriel/repos/bot/env/local/lib/python2.7/site-packages/signalr/_connection.py", line 53, in wrapped_listener
listener()
File "/home/gabriel/repos/bot/env/local/lib/python2.7/site-packages/signalr/transports/_ws_transport.py", line 43, in _receive
self._handle_notification(notification)
File "/home/gabriel/repos/bot/env/local/lib/python2.7/site-packages/signalr/transports/_transport.py", line 50, in _handle_notification
self._connection.received.fire(**data)
File "/home/gabriel/repos/bot/env/local/lib/python2.7/site-packages/signalr/events/_events.py", line 15, in fire
handler(*args, **kwargs)
File "/home/gabriel/repos/bot/env/local/lib/python2.7/site-packages/signalr/hubs/_hub.py", line 25, in handle
rspHandlers[callId](**rspArgs)
TypeError: done_subscribe() argument after ** must be a mapping, not bool
Sun Oct 1 21:13:42 2017 <Greenlet at 0x7f529dc29af0: wrapped_listener> failed with TypeError
I'm honestly not even sure that the if statement is needed -- according to a description of the wire format the R
value returned by the server method should be "present if the method is not void". (see the section entitled "Server Side Hub Method Invocation Result")
Hi, unfortunately I don't have enough time to maintain the repo. So if anyone wants to take care about signalr-client-py it'll be highly appreciated. |
Is it possible to make invoke() return a value directly? Sometimes we need a sync call to the server. The response parameter is a callback. |
Added response callback support to HubServer's invoke() function. Usage: