Stomp.js is out of date and no longer maintained - which Stomp client to use with Spring Websockets?
Asked Answered
C

3

25

I found it surprising that the current documentation for the Spring WebSocket Support directs users to use stomp.js for their client-side JavaScript implementation.

This project, on the ReadMe on it's GitHub page, says:

This project is no longer maintained.

If you encounter bugs with it or need enhancements, you can fork it and modify it as the project is under the Apache License 2.0.

The repository hasn't had any commits since September 2015 (which was just to add the above to the ReadMe), and no code commits since December 2014, so it has effectively been abandoned for the past 2 years.

I am unsure which of the 284 forks of the repository would be a stable and up-to-date version of the library, and there seems to be no viable alternative from a Google search.

Could someone please recommend a stable alternative that could be used instead?

Ideally my hope is the Spring team could provide some direction about the right client library to use with their STOMP support.

Coronet answered 13/12, 2016 at 10:51 Comment(4)
Did you ever find a resolution to this?Stabilize
@Stabilize No I didn't, I was hoping someone from the Spring webscoket team would reply here, since they seem to say their support is now Stackoverflow-basedCoronet
@Stabilize Please see the below answer, the Spring Websocket documentation now points to github.com/JSteunou/webstomp-client as the library to use.Coronet
That project is now also archived on Github. The Spring documentation still links to it as it seems.Whelm
C
15

I've been wondering about this as well, but haven't been able to find anything concrete. The closest I've come across has been webstomp-client:

https://github.com/JSteunou/webstomp-client

It claims to be a fork of the original stomp.js, and it looks like it's actively maintained.


Unrelated to the question, but related to what I've been working on recently, I also found a fork of webstomp-client that implements an RxJS client as well; posting some links in case it's useful to someone in the future.

https://github.com/Clanrat/webstomp-client

https://github.com/Clanrat/webstomp-client/blob/master/src/rxclient.js

Cosh answered 10/3, 2017 at 21:51 Comment(2)
The Spring Websocket documentation has now been updated to recommend github.com/JSteunou/webstomp-client as the most actively maintained implementation.Coronet
At this point in time webstomp-client github repo is archived. Still looking for a good option for production.Coniah
D
7

Please check https://github.com/stomp-js/stompjs (@stomp/stompjs at npm). It is based on the original, however fixes known issues, supports auto reconnect, binary data, callbacks. Written in Typescript and distributed as UMD (usable from Node as well as browsers).

It also has variants for RxJS (https://github.com/stomp-js/rx-stomp) and Angular (https://github.com/stomp-js/ng2-stompjs).

This is actively maintained.

Datolite answered 19/11, 2018 at 14:39 Comment(1)
as others have mentioned webstomp-client mentioned in the spring documentation is archived now, the one in this answer seems to be listed in stomp client implementations.Aggressor
S
2

The maintainer for https://github.com/stomp-js/stompjs seems to have forked his own thing (presumably Deepak Kumar). Of which, 'auto-reconnect' didn't actually work for me in Safari with this version and SocksJS.

var ws = new SockJS(url);
var client = Stomp.over(ws);

client.reconnect_delay = 5000;

So, It was hard for me to find the 'legit' and properly supported version as well because of this. But I did run across this link from the original authors site: https://github.com/jmesnil/stomp-websocket/issues/121 where the original author Jeff Mesnil was in conversation with Rossen Stoyanchev (anyone who knows Spring knows who he is) and seemed to have blessed the maintenance fork by Jérôme Steunou located here: https://github.com/JSteunou/webstomp-client . So, I think I'll be using this version.

Hopefully that helps others who are getting lost in the various versions of unofficial forks kludge (like I was) with very inconsistent results.

Spadix answered 15/3, 2019 at 21:41 Comment(2)
When using SockJS you need to pass a factory that returns a socket instance for reconnect to work. Change your code to client = Stomp.over(() => new SockJS(url));. See stomp-js.github.io/api-docs/latest/classes/Stomp.html#overDatolite
Not needed if you use the real fork I outlined above. Seems like only your fork requires this.Spadix

© 2022 - 2024 — McMap. All rights reserved.