Angular 2+ WebSocket wrapper with RxJS Subject streams. Version 0.9.8 (latest since 2019) is built against Angular 2 and RxJS 5/6. Provides automatic reconnect, send modes (Direct, Observer, Promise), and binary type configuration. Differs from angular-websocket by targeting Angular 2+ with TypeScript. Requires peer dependencies: core-js, reflect-metadata, TypeScript 3.2, zone.js.
npm install angular2-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: connect to a WebSocket, send a message, and handle incoming data using RxJS streams.
Consider using native WebSocket with RxJS 'webSocket' from 'rxjs/webSocket'.
Change import to 'angular2-websocket/angular2-websocket'.
Explicitly set binary type in constructor: new $WebSocket(url, null, null, 'blob').
Use WebSocketSendMode.Direct or call .publish().connect() on the returned Observable.
Remove reflect-metadata import if using Angular 13+ and zone.js 0.12+
Change import to 'angular2-websocket/angular2-websocket'.
Use: const stream = ws.getDataStream(); stream.subscribe(...);
Send with mode: ws.send('data', WebSocketSendMode.Promise).then(...);