mandrewcito / signalrcore

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

Problem with serialization #88

Open bretbas opened 2 years ago

bretbas commented 2 years ago

Hello, everyone! I wanted to test your lib for using it in the prod, but i could't to send message, because it is not serialized right I create the same client app, but on the dotnet, and all work fine.

But when i use your lib, i have a problem:

2022-04-09 16:38:18,640 - SignalRCoreClient - DEBUG - Handler registered started TestClientEvent

2022-04-09 16:38:18,642 - SignalRCoreClient - DEBUG - Connection started

2022-04-09 16:38:18,642 - SignalRCoreClient - DEBUG - Negotiate url:http://localhost:40071/test-hub/negotiate

2022-04-09 16:38:18,710 - SignalRCoreClient - DEBUG - Response status code200

2022-04-09 16:38:18,711 - SignalRCoreClient - DEBUG - start url:ws://localhost:40071/test-hub?id=FumuYZ40TqJWOVEMYe8sRA

2022-04-09 16:38:18,711 - SignalRCoreClient - DEBUG - Sending message InvocationMessage: invocation_id b0b25f8e-b8fa-4e7a-84ff-b51272f4a06e, target TestMethod, arguments [<class '__main__.subject'>]

Traceback (most recent call last):

  File "C:/Users/Сергей/PycharmProjects/pythonProject1/main.py", line 44, in <module>

    hub_connection.send("TestMethod", [subject])

  File "C:\Users\Сергей\PycharmProjects\SignalRTest\lib\site-packages\signalrcore\hub\base_hub_connection.py", line 147, in send

    self.transport.send(message)

  File "C:\Users\Сергей\PycharmProjects\SignalRTest\lib\site-packages\signalrcore\transport\websockets\websocket_transport.py", line 217, in send

    raise ex

  File "C:\Users\Сергей\PycharmProjects\SignalRTest\lib\site-packages\signalrcore\transport\websockets\websocket_transport.py", line 196, in send

    self.protocol.encode(message),

  File "C:\Users\Сергей\PycharmProjects\SignalRTest\Lib\signalrcore\protocol\messagepack_protocol.py", line 72, in encode

    encoded_message = msgpack.packb(msg)

  File "C:\Users\Сергей\PycharmProjects\SignalRTest\lib\site-packages\msgpack\__init__.py", line 35, in packb

    return Packer(**kwargs).pack(o)

  File "msgpack\_packer.pyx", line 292, in msgpack._cmsgpack.Packer.pack

  File "msgpack\_packer.pyx", line 298, in msgpack._cmsgpack.Packer.pack

  File "msgpack\_packer.pyx", line 295, in msgpack._cmsgpack.Packer.pack

  File "msgpack\_packer.pyx", line 264, in msgpack._cmsgpack.Packer._pack

  File "msgpack\_packer.pyx", line 264, in msgpack._cmsgpack.Packer._pack

  File "msgpack\_packer.pyx", line 289, in msgpack._cmsgpack.Packer._pack

TypeError: can not serialize 'type' object