-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Add MQTT over WebSocket support [SPR-12581] #17182
Comments
Juergen Hoeller commented Rossen, for consideration in 4.2... |
Rossen Stoyanchev commented Right along with WAMP support (#16288).. |
Rossen Stoyanchev commented MQTT (client) support in Spring Integration based on the Eclipse Paho client: |
Rossen Stoyanchev commented pascal gehl I've done some some basic prototyping using the Eclipse Paho browser client and RabbitMQ (with MQTT enabled) as the backing broker. While I was able to relay messages in both directions, an important observation to make is that since all WebSocket messages are binary we won't be able to support SockJS fallback transports. Currently the SockJS protocol does not support binary messages and it probably won't without "evidence of demand". See this recent exchange for example sockjs/sockjs-protocol#74 (comment). How much does that matter to you? I would imagine that even if mobile phones have a WebSocket client available, there is still the issue with network proxies interfering over the public Internet. |
pascal gehl commented Thanks a lot Rossen for your quick answer. |
Rossen Stoyanchev commented Okay it would be great to get some further thoughts. We could make the case for binary support in SockJS, that kind of feedback would be required at a minimum. From a Spring Framework perspective MQTT over WebSocket for 4.2 looks quite feasible. |
Rossen Stoyanchev commented Postponing until we get more votes and motivation. |
Puran Singh commented Just voted :) |
Rossen Stoyanchev commented Thanks puran. Unfortunately I seem to have lost the local branch following a corruption of my git index not long ago. That will teach me to always push to my own fork as a backup. It would be interesting if you share more of your thoughts on this. Especially as it relates to the fact that (currently) SockJS does not support binary data and we can't provide HTTP fallback options. |
Puran Singh commented Basically, I am trying to use that setting for mobile apps and don't really need SockJS, at least for now. So, trying to just relay a message via spring websocket connection from a device to MQTT server |
Rossen Stoyanchev commented I see, chances are however that you do need SockJS (or something like it) since over the public Internet a WebSocket connection could be closed by a proxy. |
Puran Singh commented Yeah most probably. But, for mobile at least in my case I am assuming it won't be an issue. If connection is dropped I can always send background push notification and re-establish a connection. Also, at this point I am only concerned about text based but didn't want to use STOMP since I may do binary data in future. |
Rossen Stoyanchev commented Okay good to know, thanks! I'll try to re-establish a branch and publish that. Also for what it's worth re-establishing the connection may not necessarily be a successful strategy, at least not against proxies that deliberately close the connection. |
Puran Singh commented Yeah you are right. Specially with mobile networks, and their proxies! Though, using it over SSL port 443 seems to solve this issue. I haven't tested it myself! |
Rossen Stoyanchev commented Almost forgot to mention. STOMP does support binary data payloads. |
Rainer Frey commented FWIW, I have a use case in mind where this would be helpful: a Spring Boot application that connects with MQTT enabled devices, and a small set of users in a controlled environment where I can afford to exclude users for whom websockets don't work. That specific project is a small hobby project with low priority though. It would certainly not be too hard to adapt/relay different protocols, with either the application or RabbitMQ, but using a single protocol would still be nice. |
Closing as we have no plans to add this. |
pascal gehl opened SPR-12581 and commented
STOMP over websocket is really nice as starting point but for resource-constrained devices and low bandwidth (lots of mobile out there running on small data plans and not necessarily 4G) it would be nice to be able to choose MQTT instead of STOMP when implementing websocket based messaging.
Issue Links:
6 votes, 17 watchers
The text was updated successfully, but these errors were encountered: