mandrewcito / signalrcore

SignalR Core python client
https://mandrewcito.github.io/signalrcore/
MIT License
115 stars 53 forks source link

A way to handle messages without event? #89

Open baegmon opened 2 years ago

baegmon commented 2 years ago

I'm looking through the examples and source code but I can't seem to get an idea of how to do this. I send my message using the following:

hub_connection.send( "GetMessages", arguments=[""], on_invocation=on_success )

This works fine and from here I am expecting a couple of messages:

Raw message incomming:
Message received{"type":3,"invocationId":"77e18329-dae3-4893-a4a9-d5ba7f891575","result":null
Raw message incomming:
Message received{"type":3,"invocationId":"0d53d44a-82ff-4695-bd8e-91bbb25731fa","result":[...snipped data]

My send message results in the server sending two messages, which I successfully receive by looking at trace. I can handle the first message fine via "on_invocation" function (I can print the result and show that it is None). However; I can't seem to intercept the second request which does not have an empty "result".

Is there a way to intercept multiple requests in the on_invocation function or a way to manually handle the raw messages received?