mandrewcito / signalrcore

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

Unable to subscribe to events with multiple parameters #110

Open andreasimeonegroovejones opened 6 months ago

andreasimeonegroovejones commented 6 months ago

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):

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)