stomp-js / ng2-stompjs

Angular 6 and 7 - Stomp service over Websockets
https://stomp-js.github.io/
Apache License 2.0
182 stars 32 forks source link

Support for protobuf #7

Closed pantonis closed 7 years ago

pantonis commented 7 years ago

Does the library support protobuf or just json data?

kum-deepak commented 7 years ago

This library only transports strings - so anything that can be converted to string should work. However, STOMP is a text protocol and out of the box, WebSTOMP implementation of RabbitMQ will not handle binary data (non UTF-8). Even strings in Javascript is not friendly with binary data.

If your final encoding in case of Protobuf is base64 (which maps binary data in in ASCII range), it will work.

Angular wrapper does not alter the way underlying stompjs library works in this regard. If you have figured out a way to use Protobufs with stompjs the same might work with ng2-stompjs.

If your final encoding is binary, not sure if it will work. At the least content-length headers must always be set in messages, whether sent by ng2-stompjs or other side. In absence of this header frames are assumed to be null terminated.

Will be interested in knowing how it goes for you.

pantonis commented 7 years ago

WebStomp in rabbitmq supports binary frames on the websocket endpoint. https://www.rabbitmq.com/web-stomp.html and go to WebSocket Options and Content Encoding.

stompjs does not work with binary

pantonis commented 7 years ago

Closing this issue and referencing issue opened in stompjs repo