{"id":49741,"library":"webstomp-obs","title":"webstomp-obs","description":"A STOMP client for Web browsers and Node.js using RxJS Observables, providing a reactive approach to WebSocket messaging. Current stable version: 1.5.0. It forks the popular webstomp-client library, reimplementing the API with Observables for automatic connection sharing, reconnection, and resubscription. Key differentiators include shared WebSocket connections among subscribers, automatic reconnection with configurable retries, and automatic disconnection when the last subscriber unsubscribes. Supports modern browsers and Node.js with pluggable WebSocket libraries. Released under MIT license. Primarily used with Angular or other RxJS-based applications.","status":"active","version":"1.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/fpozzobon/webstomp-obs","tags":["javascript","typescript","stomp","webstomp","webstompobs","websocket","observable"],"install":[{"cmd":"npm install webstomp-obs","lang":"bash","label":"npm"},{"cmd":"yarn add webstomp-obs","lang":"bash","label":"yarn"},{"cmd":"pnpm add webstomp-obs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for Observable-based API","package":"rxjs","optional":false}],"imports":[{"note":"Default import provides the main library object with client() and over() methods.","wrong":"const webstompobs = require('webstomp-obs'); // Works in CJS, but ESM is preferred","symbol":"default (webstompobs)","correct":"import webstompobs from 'webstomp-obs';"},{"note":"For TypeScript users, import types using 'import type' to avoid runtime errors.","wrong":"import { Client } from 'webstomp-obs'; // Will cause runtime error if used as value","symbol":"Client (TypeScript type)","correct":"import type { Client, IFrame } from 'webstomp-obs';"},{"note":"This is the standard way to create a client in browser environments where WebSocket is global.","wrong":"","symbol":"webstompobs.client","correct":"const client = webstompobs.client('ws://example.com/stomp');"},{"note":"Use over() for Node.js or custom WebSocket implementations.","wrong":"const client = webstompobs.over('ws://example.com/stomp'); // over expects a function, not a URL","symbol":"webstompobs.over","correct":"const client = webstompobs.over(() => new WebSocket('ws://example.com/stomp'));"}],"quickstart":{"code":"import webstompobs from 'webstomp-obs';\nimport { Subject } from 'rxjs';\n\n// Create a STOMP client connecting to RabbitMQ default Web-Stomp endpoint\nconst client = webstompobs.client('ws://localhost:15674/ws');\n\n// Connect using default login/passcode (guest/guest for RabbitMQ)\nconst connection$ = client.connect('guest', 'guest');\n\n// Subscribe to a queue\nconst messages$ = new Subject();\nconnection$.subscribe({\n  next: (frame) => {\n    console.log('Connected: ' + frame.headers['session']);\n    // Subscribe to /queue/test\n    client.subscribe('/queue/test', (msg) => {\n      const body = msg.body;\n      console.log('Received: ' + body);\n      messages$.next(body);\n    });\n  },\n  error: (err) => console.error('Connection error: ' + err),\n  complete: () => console.log('Connection closed')\n});\n\n// Send a message\nsetTimeout(() => {\n  client.send('/queue/test', 'Hello STOMP!', {});\n}, 2000);","lang":"typescript","description":"Creates a STOMP client, connects to a RabbitMQ Web-Stomp endpoint, subscribes to a queue, logs received messages, and sends a test message after 2 seconds."},"warnings":[{"fix":"Use webstompobs.over(() => new (require('ws'))('ws://...')) for Node.js.","message":"The client() function uses the global WebSocket object. In Node.js, you must use over() with a custom WebSocket implementation.","severity":"gotcha","affected_versions":"*"},{"fix":"Refer to the library's own documentation or the source code for the correct method signatures.","message":"The APIs from the original stomp-websocket documentation may not fully match this library's Observable-based API.","severity":"deprecated","affected_versions":"*"},{"fix":"Set a finite maxConnectAttempt or unsubscribe on component destroy to prevent resource leaks.","message":"Automatic reconnection uses exponential backoff. Setting maxConnectAttempt to -1 causes infinite retries, which may cause memory or connection leaks.","severity":"gotcha","affected_versions":"*"},{"fix":"Stick to default text mode unless your broker explicitly supports binary STOMP frames.","message":"Binary mode (binary: true) is experimental and may not work with all STOMP brokers.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.5.0':25 'among':52 'angular':83 'api':36 'applic':89 'approach':18 'automat':40,54,60 'base':88 'browser':9,69 'client':6,32 'configur':57 'connect':41,51 'current':22 'differenti':47 'disconnect':61 'fork':27 'includ':48 'javascript':90 'key':46 'last':64 'librari':33,75 'licens':79 'messag':21 'mit':78 'modern':68 'node.js':11,71 'ob':3 'observ':14,38,96 'pluggabl':73 'popular':29 'primarili':80 'provid':15 'reactiv':17 'reconnect':43,55 'reimplement':34 'releas':76 'resubscript':45 'retri':58 'rxjs':13,87 'rxjs-base':86 'share':42,49 'stabl':23 'stomp':5,92 'subscrib':53,65 'support':67 'typescript':91 'unsubscrib':66 'use':12,81 'version':24 'web':8 'websocket':20,50,74,95 'webstomp':2,31,93 'webstomp-cli':30 'webstomp-ob':1 'webstompob':94","created_at":"2026-06-07T17:03:22.199976+00:00","updated_at":"2026-06-07T17:03:22.199976+00:00","problems":[{"fix":"Use webstompobs.over(() => new WebSocket('...')) with a WebSocket library like 'ws'.","cause":"Using client() in Node.js where WebSocket is not globally defined.","error":"Error: No WebSocket object found. Use webstompobs.over() instead of webstompobs.client() in Node.js."},{"fix":"Use `import webstompobs from 'webstomp-obs'` (default import) or `const webstompobs = require('webstomp-obs')`.","cause":"Importing the default export incorrectly or using a wrong import path.","error":"TypeError: webstompobs.client is not a function"},{"fix":"Set maxConnectAttempt to a finite number (e.g., 10) and handle the error Observable appropriately.","cause":"maxConnectAttempt set to -1 or the server keeps rejecting connections.","error":"Error: Connection lost, reconnecting... (infinite loop)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/fpozzobon/webstomp-obs#readme","github":"https://github.com/fpozzobon/webstomp-obs","docs":null,"changelog":null,"pypi":null,"npm":"webstomp-obs","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}