webstomp-client is a JavaScript library providing a STOMP client over WebSockets for both browser and Node.js environments. Currently at version 1.2.6, it does not follow a fixed release cadence but rather ships updates as needed, addressing bug fixes and minor enhancements. This project is an active fork of the original `stomp-websocket` library by Jeff Mesnil and Jeff Lindsay, having been rewritten in ES6 to modernize its codebase and integrate community-contributed pull requests that were pending in the upstream project. Its key differentiators include modern ES6 syntax, built-in TypeScript type definitions, and explicit support for supplying custom WebSocket implementations (e.g., `ws` or `sockjs-client` in Node.js) via the `webstomp.over()` method, rather than relying solely on a global `WebSocket` object like its predecessor or browser-only alternatives. For browser environments, it automatically uses the global `WebSocket` object. It provides a robust API for connecting, subscribing, sending messages, and handling disconnections with STOMP servers like RabbitMQ Web-STOMP.
npm install webstomp-clientVerified import paths — ran on the pinned version, not inferred.
Demonstrates connecting to a STOMP server via WebSockets in a Node.js environment using `webstomp.over()`, subscribing to a queue, sending a message, and properly disconnecting. Requires a running STOMP server (e.g., RabbitMQ with Web-STOMP plugin) and the `ws` npm package for Node.js WebSocket support.
Change your imports to `import webstomp from 'webstomp-client';` and access methods as `webstomp.client()` or `webstomp.over()`.
Install a WebSocket client (`npm install ws`) and use `webstomp.over(new WebSocket(url))` instead of `webstomp.client(url)`.
Refer to the API documentation for the correct `connect` signature matching your authentication method. Example: `client.connect({ login, passcode }, connectCallback)` or `client.connect(headers, connectCallback)`.Pass `{ heartbeat: false }` in the options object during client initialization: `webstomp.over(ws, { heartbeat: false })`.For Node.js, use `webstomp.over(new WebSocket(url))` with a custom WebSocket implementation like `ws`. Ensure you are using the default import: `import webstomp from 'webstomp-client';`.
In Node.js, explicitly use `webstomp.over(ws_instance)` and pass an instance of a Node.js WebSocket client (e.g., from the `ws` package). Alternatively, you could polyfill `global.WebSocket = require('ws');` but `webstomp.over` is the idiomatic way.Use a type-only import: `import type { Client } from 'webstomp-client';`.No dependency data recorded yet.