Connect and emit data from BitMEX Websocket API.
npm install bitmex-socketthis in place of variable refernce in function.
standalone: true ignored the autoconn: true option.
stream.reply() and socket.command() in lieu of internal event messages _download and _upload. stream.on('_download', type, reply) for all raw messages received on the socket. To send commands back stream.emit('_upload', { }) with the object being a valid message to BitMEX. { op: "subscribe", args: "trade" } for example. To change the message type, add a type item to the object. { type: 2 } sends an empty dc message.
trade:XBTUSD) now emit their events under the global table and emit a second param for the channel. stream.on('subscribe', (table, channel) => {}) If channel is omitted, it's the global table subscribe(table), otherwise it's a specific one subscribe(table:symbol).
stream.send(dir, type = 'GET', data = {}). Streams that have authenticated on the socket may also perform private REST functions such as making new orders or whatever other permissions the API key allows.
stream.on('partial|insert|update|delete', (table, data, row) => {}): data was sending wrong data object.
stream.authenticate(key, secret, force = false): stream.authenticate() won't add the authenticate message to socket queue if stream isn't already connected unless force is true. It will however add the supplied key/secret to the secureContext for authentication later if connect() is called manually.