Skip to content
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

Unable to subscribe to events with multiple parameters #110

Open
andreasimeonegroovejones opened this issue Mar 7, 2024 · 0 comments
Open

Comments

@andreasimeonegroovejones

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant