{"id":48712,"library":"ngx-websocket","title":"ngx-websocket","description":"A simple WebSocket connection manager for Angular 4+ applications. Current version 0.4.2 is highly unstable and explicitly warns against use in production due to potential breaking changes without notice. Ships TypeScript types and requires Angular 6+ (peer deps). Minimal documentation and incomplete error handling (as noted in TODOs). Not recommended for new projects; consider alternatives like RxJS WebSocket or ngx-socket-io.","status":"deprecated","version":"0.4.2","language":"javascript","source_language":"en","source_url":"https://github.com/simpleyin/ngx-websocket","tags":["javascript","typescript"],"install":[{"cmd":"npm install ngx-websocket","lang":"bash","label":"npm"},{"cmd":"yarn add ngx-websocket","lang":"bash","label":"yarn"},{"cmd":"pnpm add ngx-websocket","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for Angular module and service functionality.","package":"@angular/common","optional":false},{"reason":"Required peer dependency for Angular dependency injection and decorators.","package":"@angular/core","optional":false}],"imports":[{"note":"Named export, not default.","wrong":"import NgxWebSocketModule from 'ngx-websocket';","symbol":"NgxWebSocketModule","correct":"import { NgxWebSocketModule } from 'ngx-websocket';"},{"note":"Service is exported from the main module barrel.","wrong":"import { NgxWebsocketService } from 'ngx-websocket/ngx-websocket-service';","symbol":"NgxWebsocketService","correct":"import { NgxWebsocketService } from 'ngx-websocket';"},{"note":"ESM only; CommonJS require may work but is not the intended pattern. TypeScript definitions are included.","wrong":"const Socket = require('ngx-websocket').Socket;","symbol":"Socket","correct":"import { Socket } from 'ngx-websocket';"}],"quickstart":{"code":"import { NgxWebSocketModule, NgxWebsocketService, Socket } from 'ngx-websocket';\n\n@NgModule({\n  imports: [NgxWebSocketModule],\n  // ...\n})\nexport class AppModule {}\n\n@Component({...})\nexport class TestComponent {\n  constructor(private service: NgxWebsocketService, private socket: Socket) {}\n\n  open(): void {\n    this.service.open('ws://echo.websocket.org')\n      .then((d: any, socket: any) => socket.send('hi'))\n      .message((d: any) => d + ' siri')\n      .then((d: any) => console.log(d));\n  }\n}","lang":"typescript","description":"Demonstrates importing the module, injecting services, and opening a WebSocket connection."},"warnings":[{"fix":"Do not use in production. Consider RxJS WebSocket or ngx-socket-io instead.","message":"Package is explicitly marked as 'extreamly unstable' and will be overwritten occasionally.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Migrate to a maintained WebSocket library like rxjs/webSocket or ngx-socket-io.","message":"Package has not been updated since 2018 and relies on Angular 6+ peer dependencies. It is incompatible with Angular 12+.","severity":"deprecated","affected_versions":">=0.4.0"},{"fix":"Refer to minimal examples in README; avoid relying on undocumented features.","message":"The API is non-standard and undocumented. The open() method returns a promise with a custom chainable .message() method that may not exist in the future.","severity":"gotcha","affected_versions":">=0.4.0"}],"env_vars":null,"search_vec":"'0.4.2':15 '4':11 '6':39 'altern':58 'angular':10,38 'applic':12 'break':29 'chang':30 'connect':7 'consid':57 'current':13 'dep':41 'document':43 'due':26 'error':46 'explicit':20 'handl':47 'high':17 'incomplet':45 'io':66 'javascript':67 'like':59 'manag':8 'minim':42 'new':55 'ngx':2,64 'ngx-socket-io':63 'ngx-websocket':1 'note':49 'notic':32 'peer':40 'potenti':28 'product':25 'project':56 'recommend':53 'requir':37 'rxjs':60 'ship':33 'simpl':5 'socket':65 'todo':51 'type':35 'typescript':34,68 'unstabl':18 'use':23 'version':14 'warn':21 'websocket':3,6,61 'without':31","created_at":"2026-06-07T16:58:04.958322+00:00","updated_at":"2026-06-07T16:58:04.958322+00:00","problems":[{"fix":"Use 'import { ... } from 'ngx-websocket';' – the library ships its own types.","cause":"Missing TypeScript types or incorrect import path.","error":"Cannot find module 'ngx-websocket' or its corresponding type declarations."},{"fix":"Add 'NgxWebSocketModule' to the imports array of your @NgModule.","cause":"NgxWebSocketModule not imported in the Angular module.","error":"NullInjectorError: No provider for NgxWebsocketService!"},{"fix":"Cast to 'any' or define a custom interface. Example: '(this.service.open(...) as any).message(...)'.","cause":"TypeScript does not recognize the custom .message() chain method on the promise returned by open().","error":"Property 'message' does not exist on type 'Promise<void>'."}],"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/simpleyin/ngx-websocket#readme","github":"https://github.com/simpleyin/ngx-websocket","docs":null,"changelog":null,"pypi":null,"npm":"ngx-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}}