mandrewcito / signalrcore

SignalR Core python client

Home Page:https://mandrewcito.github.io/signalrcore/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to subscribe to events with multiple parameters

andreasimeonegroovejones opened this issue · comments

Describe the bug
When subscribing on a SignalR method with multiple parameters, I get an error and the message is not processed correctly.

To Reproduce

# method to be called once we receive the event ObjectDetectionData from the server with playerX, playerY, ballX, ballY
def ObjectDetectionData(playerX, playerY, ballX, ballY):
    print("Player position: (", playerX, ", ", playerY, ")")
    print("Ball position: (", ballX, ", ", ballY, ")")
    pass

hub_connection.on("ObjectDetectionData", ObjectDetectionData)

This is what the server is sending (Using .Net)

    public async Task ObjectDetectionData(float playerX, float playerY, float ballX, float ballY)
    {
        await Clients.All.SendAsync("ObjectDetectionData", playerX, playerY, ballX, ballY);
    }

Expected behavior
The 2 strings with the received data should appear in the terminal

Desktop (please complete the following information):

  • OS: Windows
  • Browser (no browser: server is dotnet8, client is python 3.7)
  • Version latest, 0.9.5

Additional context
Error message:

error from callback <bound method WebsocketTransport.on_message of <signalrcore.transport.websockets.websocket_transport.WebsocketTransport object at 0x0000028D08F7D888>>: ObjectDetectionData() missing 3 required positional arguments: 'playerY', 'ballX', and 'ballY'
File "C:\Python37\lib\site-packages\websocket_app.py", line 400, in _callback
callback(self, *args)
File "C:\Python37\lib\site-packages\signalrcore\transport\websockets\websocket_transport.py", line 190, in on_message self.protocol.parse_messages(raw_message))
File "C:\Python37\lib\site-packages\signalrcore\hub\base_hub_connection.py", line 179, in on_message
handler(message.arguments)