This is the official websocket module for bitbeat using ws.
This package will export you a websocket server and a websocket server config.
To use it follow the documentation of bitbeat at the homepage.
The default WebConfig looks like this:
exportdefaultclassWebSocketServerConfigextendsConfiguration{constructor(){super();}default: {host: string;port: number;[name: string]: any;}={host: 'localhost',port: 5000,perMessageDeflate: {zlibDeflateOptions: {chunkSize: 1024,memLevel: 7,level: 3,},zlibInflateOptions: {chunkSize: 10*1024,},clientNoContextTakeover: true,serverNoContextTakeover: true,serverMaxWindowBits: 10,concurrencyLimit: 10,threshold: 1024,},};}You can edit those properties by either extending the WebSocketConfig class in your project's config folder as own class or edit it in the boot.js.
-- config
|-- myOwnConfig.ts
import{WebSocketConfig}from'@bitbeat/websocket';import{merge}from'lodash';exportdefaultclassMyOwnConfigextendsWebSocketConfig{constructor(){super();}default={};// this will overwrite the default props/* or you can do something non-destructive like this default = merge(default, { port: 3000, }); */}This example happens in the boot.js:
import{registerBulk}from'@bitbeat/core';import{WebSocketConfig,WebSocketServer}from'@bitbeat/websocket';exportdefaultasync()=>{constwebSocketConfig=newWebSocketConfig();webSocketConfig.default.port=3000;awaitregisterBulk(newSet([webSocketConfig,WebSocketServer]));};