webstomp-client is a JavaScript library that provides a WebSocket client for the STOMP (Simple Text Oriented Messaging Protocol) protocol. It allows developers to easily connect to STOMP servers and manage messaging in real-time applications. While webstomp-client is a robust option for handling STOMP messaging, there are several alternatives in the ecosystem that also provide WebSocket and STOMP functionalities. Here are a few notable alternatives:
@stomp/stompjs is a popular library that implements the STOMP protocol for JavaScript applications. It is designed to work seamlessly with WebSocket and provides a comprehensive set of features for connecting to STOMP servers. This library is well-suited for developers who need a reliable and feature-rich solution for STOMP messaging in their applications. It supports various features like heartbeats, message acknowledgments, and error handling, making it a strong choice for complex real-time applications.
reconnecting-websocket is a library that enhances the native WebSocket API by adding automatic reconnection capabilities. While it does not specifically implement the STOMP protocol, it can be used in conjunction with STOMP libraries to ensure that WebSocket connections are resilient and can recover from disconnections. This library is ideal for applications that require a stable WebSocket connection with minimal manual intervention for handling reconnections.
sockjs-client is another alternative that provides a WebSocket-like object that can fall back to other transport protocols when WebSockets are not available. It is particularly useful for applications that need to support a wide range of environments and browsers. While sockjs-client does not implement the STOMP protocol directly, it can be used alongside STOMP libraries to provide a more robust connection layer, ensuring that messaging works across different network conditions.
stompjs is an older library that also implements the STOMP protocol for JavaScript applications. It provides basic functionalities for connecting to STOMP servers and handling messaging. While it may not have all the features of more modern libraries like @stomp/stompjs, it can still be a viable option for simpler use cases or legacy applications that require STOMP support.
This library provides a stomp client for Web browsers and nodejs through Web Sockets.
Project Status
This is a fork of the original stomp-websocket re-written in ES6 and incorporate pending pull requests. All credits goes to the original authors: Jeff Mesnil & Jeff Lindsay.
Browsers support
Only ES5 compatible modern browsers are supported. If you need a websocket polyfill you can use sockjs
nodejs support
As nodejs does not have a WebSocket object like browsers have, you must choose a websocket client and use webstomp.over instead of webstomp.client. Choosing a good client is maybe the most difficult part:
npm run example will open examples in browser and try to connect to RabbitMQ Web-Stomp default Web Sockets url.
node run example/broadcast-node.js will run a dead simple nodejs example.