Stomp.js can now be used in node.js app to connect to STOMP brokers over TCP socket or Web Sockets

This version adds the heart-beat feature that was missing in version 2.2.0

Install the package:

$ npm install stompjs

In the node.js app, require the module with:

var Stomp = require('stompjs');

To connect to a STOMP broker over a TCP socket, use the Stomp.overTCP(host, port) method:

var client = Stomp.overTCP('localhost', 61613);

To connect to a STOMP broker over a WebSocket, use instead the Stomp.overWS(url) method:

var client = Stomp.overWS('ws://localhost:61614');

Apart from this initialization, the STOMP API remains the same whether it is running in a Web browser or in node.js application.

Downloads