Open christopherjameshoward opened 1 year ago
hi, that seems like a reasonable solution. There would need to be a configuration at the WSConnection constructor, default as tring, since by default RabbitMQ is configured as UTF-8
By default, the Web STOMP plugin will expect to handle messages encoded as UTF-8
Here is the PR: https://github.com/jasonrbriggs/stomp.py/pull/419
Using stomp.py-8.1.0
The server I am connecting to is RabbitMQ with the
rabbitmq_web_stomp
plugin.The web stomp plugin is configured to send binary messages, as documented here: https://www.rabbitmq.com/web-stomp.html#content-encoding:
When I attempt to open a connection to RabbitMQ using the
stomp.WSConnection
class, I receive an exception:which leads to a
ConnectFailedException
:The problem seems to be that the
WSTransport.receive
method assumes that all websocket messages are strings, and tries to convert them back into bytes: https://github.com/jasonrbriggs/stomp.py/blob/dev/stomp/adapter/ws.py#L215I think it would be possible to fix this issue by calling the
recv_data
method, rather thanrecv
:If you agree, I would be happy to submit a PR.