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.

Community
  • 1
  • 1
rikoe
  • 1,639
  • 1
  • 21
  • 29
  • Did you ever find a resolution to this? – Slipfish Mar 01 '17 at 21:20
  • @Slipfish 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-based – rikoe Mar 06 '17 at 10:57
  • @Slipfish Please see the below answer, the Spring Websocket documentation now points to https://github.com/JSteunou/webstomp-client as the library to use. – rikoe Feb 21 '18 at 09:54
  • That project is now also archived on Github. The Spring documentation still links to it as it seems. – Nexonus Nov 04 '22 at 10:25

3 Answers3

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

Hristo
  • 45,559
  • 65
  • 163
  • 230
  • Thanks. Just for future – Amir Jan 09 '18 at 13:54
  • 1
    The [Spring Websocket documentation](https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#websocket-stomp) has now been updated to recommend https://github.com/JSteunou/webstomp-client as the most actively maintained implementation. – rikoe Feb 21 '18 at 09:53
  • 2
    At this point in time `webstomp-client` github repo is archived. Still looking for a good option for production. – It's K Jun 27 '21 at 08:50
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.

Deepak Kumar
  • 944
  • 9
  • 12
  • as others have mentioned [webstomp-client](https://github.com/JSteunou/webstomp-client) mentioned in the [spring documentation](https://docs.spring.io/spring-framework/reference/web/websocket/stomp/enable.html) is archived now, the one in this answer seems to be listed in [stomp client implementations](https://stomp.github.io/implementations.html). – Sidharth Bajpai May 14 '23 at 13:49
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.

Gary Tessman
  • 433
  • 4
  • 3
  • 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 https://stomp-js.github.io/api-docs/latest/classes/Stomp.html#over – Deepak Kumar May 25 '19 at 17:37
  • Not needed if you use the real fork I outlined above. Seems like only your fork requires this. – Gary Tessman May 26 '19 at 18:53