You can download ng2websocket by:
- Using npm and running
npm install ng2websocket --save
- Downloading it manually by clicking here to download development unminified version
- import {ng2websocket} from 'ng2websocket/ng2websocket';
name | arguments | description |
---|---|---|
ng2websocket constructor |
addr:String,proto:string,reconnectMaxTimeS:number, onMessage,onOpen,onClose,onError |
Creates and opens a [WebSocket] instance. ws = new ng2websocket("ws://addr","proto",30, (data)=>{this.onMessage(data);}, ()=>{this.onOpen();}, ()=>{this.onClose();}, ()=>{this.onError();} ); |
send | data:String | ArrayBuffer |
close | Close the underlying socket, |