{"id":47356,"library":"customapp-rxjs-websocket","title":"CustomApp RxJS WebSocket","description":"A package for managing WebSocket lifecycle with RxJS, inspired by Angular's WebSocket module but framework-agnostic. Current stable version 1.2.3, released monthly. Key differentiator: automatic reconnection, heartbeat, and message queuing handling in a single observable pipeline. Built for browsers and Node.js environments, ships TypeScript types.","status":"active","version":"1.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/loyal-inform/ngx-customapp-sdk","tags":["javascript","typescript"],"install":[{"cmd":"npm install customapp-rxjs-websocket","lang":"bash","label":"npm"},{"cmd":"yarn add customapp-rxjs-websocket","lang":"bash","label":"yarn"},{"cmd":"pnpm add customapp-rxjs-websocket","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Observable-based WebSocket integration","package":"rxjs","optional":false}],"imports":[{"note":"Default export removed in v2; only named exports.","wrong":"import { WebSocketClient } from 'customapp-rxjs-websocket' - correct, but ensure import is at top level","symbol":"WebSocketClient","correct":"import { WebSocketClient } from 'customapp-rxjs-websocket'"},{"note":"Enum for connection states: Connected, Disconnected, Reconnecting.","wrong":null,"symbol":"ConnectionStatus","correct":"import { ConnectionStatus } from 'customapp-rxjs-websocket'"},{"note":"Optional Angular compatibility module, not required for non-Angular usage.","wrong":"import { WebSocketModule } from 'customapp-rxjs-websocket' - only available if using Angular module imports","symbol":"WebSocketModule","correct":"import { WebSocketModule } from 'customapp-rxjs-websocket'"}],"quickstart":{"code":"import { WebSocketClient } from 'customapp-rxjs-websocket';\nimport { webSocket } from 'rxjs/webSocket';\n\nconst wsClient = new WebSocketClient({\n  url: 'wss://example.com/ws',\n  reconnectInterval: 5000,\n  maxReconnectAttempts: 10,\n  heartbeatInterval: 30000\n});\n\nwsClient.messages$.subscribe({\n  next: (msg) => console.log('Received:', msg),\n  error: (err) => console.error('Error:', err),\n  complete: () => console.log('Connection closed')\n});\n\nwsClient.connect();\n\nsetTimeout(() => wsClient.send({ event: 'ping' }), 1000);\n\nsetTimeout(() => wsClient.close(), 60000);","lang":"typescript","description":"Demonstrates creating a WebSocket client with reconnection, heartbeat, and message handling."},"warnings":[{"fix":"Use import { WebSocketClient } from 'customapp-rxjs-websocket' instead of import WebSocketClient from ...","message":"v2.0.0: Removed default export, WebSocketClient must be imported as named export.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use 'connected' | 'disconnected' | 'reconnecting' instead of ConnectionStatus.CONNECTED.","message":"v1.x: ConnectionStatus enum values are deprecated in favor of string literals.","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Ensure you import necessary operators: import { filter, map } from 'rxjs/operators'.","message":"Unexpected token: operator required for rxjs v7 compatibility when using pipe with WebSocketClient.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use custom serializer/deserializer options if binary messages are required.","message":"WebSocketClient does not support binary data (ArrayBuffer) by default. Only JSON messages.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.2.3':25 'agnost':21 'angular':14 'automat':30 'browser':44 'built':42 'current':22 'customapp':1 'differenti':29 'environ':47 'framework':20 'framework-agnost':19 'handl':36 'heartbeat':32 'inspir':12 'javascript':51 'key':28 'lifecycl':9 'manag':7 'messag':34 'modul':17 'month':27 'node.js':46 'observ':40 'packag':5 'pipelin':41 'queu':35 'reconnect':31 'releas':26 'rxjs':2,11 'ship':48 'singl':39 'stabl':23 'type':50 'typescript':49,52 'version':24 'websocket':3,8,16","created_at":"2026-06-07T16:51:06.931057+00:00","updated_at":"2026-06-07T16:51:06.931057+00:00","problems":[{"fix":"Use import { WebSocketClient } from 'customapp-rxjs-websocket' instead of const { WebSocketClient } = require(...). Ensure your project is set to ES module.","cause":"Using CommonJS require() instead of ESM import","error":"TypeError: customapp-rxjs-websocket_1.WebSocketClient is not a constructor"},{"fix":"Add WebSocketModule to imports array in your Angular module or component imports.","cause":"Forgetting to import WebSocketModule in standalone component","error":"Error: No provider for WebSocketClient - Angular 16+"},{"fix":"Ensure you subscribe to messages$ or status$ before calling connect(), or wait for connection status.","cause":"Initial connect() call before subscribing to messages or connection status","error":"Uncaught (in promise): Error: WebSocket connection to 'wss://...' failed: WebSocket is closed before the connection is established."},{"fix":"Install rxjs-compat if using v6 patterns, or migrate to v7: import { webSocket } from 'rxjs/webSocket'.","cause":"Mixing rxjs v6 compatibility layer with v7","error":"rxjs-compat/observable/dom/webSocket is not a function"}],"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/loyal-inform/ngx-customapp-sdk","github":"https://github.com/loyal-inform/ngx-customapp-sdk","docs":null,"changelog":null,"pypi":null,"npm":"customapp-rxjs-websocket","openapi_spec":null,"status_page":null,"smithery":null,"categories":["communication"],"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}}