How to use the msgpack-lite.encode function in msgpack-lite

To help you get started, we’ve selected a few msgpack-lite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github holochain / n3h / lib / hackmode / realmode.js View on Github external
async _p2pSend (peerAddress, obj) {
    // log.t(this.me() + ' >>> ' + this.nick(peerAddress) + ' - ' + obj.type)
    return this._p2p.publishReliable(
      [peerAddress],
      msgpack.encode(obj).toString('base64')
    )
  }
github holochain / n3h / lib / hackmode / realmode.js View on Github external
async _p2pSendAll (obj) {
    // log.t(this.me() + ' >>> ' + this._peerList + ' - ' + obj.type)
    return this._p2p.publishReliable(
      this._peerList,
      msgpack.encode(obj).toString('base64')
    )
  }
github holochain / n3h / packages / n3h-mod-message-mosocket / examples / c3hat / c3hat.js View on Github external
const ipcMsg = async (type, data) => {
    const resp = await client.call(
      msgpack.encode({ type, data }))
    if (!resp) {
      console.error('bad ipc response', resp)
      process.exit(1)
    }
    if (resp.byteLength) {
      return msgpack.decode(resp)
    }
  }
github jwkvam / bowtie / bowtie / src / textbox.jsx View on Github external
onPressEnter = value => {
        this.setState({ value: value.target.value });
        storeState(this.props.uuid, this.state, { value: value.target.value });
        this.props.socket.emit(this.props.uuid + '#enter', msgpack.encode(value.target.value));
    };
github allegro / node-worker-nodes / lib / worker / transport.js View on Github external
send(message) {
        const serializedMessage = msgpack.encode(message);
        const header = new Uint32Array([ serializedMessage.byteLength ]);

        this.pipe.write(Buffer.from(header.buffer));
        this.pipe.write(serializedMessage);
    }
}
github tinkerhub / tinkerhub / lib / net / tcp.js View on Github external
write(type, payload) {
		const data = msgpack.encode([ String(type), payload ]);
		this.socket.write(data);
	}
github glacambre / firenvim / src / nvimproc / Stdin.ts View on Github external
public write(reqId: number, method: string, args: any[]) {
        const req = [0, reqId, method, args];
        const encoded = msgpack.encode(req);
        this.socket.send(encoded);
    }
github colyseus / colyseus / lib / room.js View on Github external
getEncodedState () {

    return msgpack.encode( utils.toJSON( this.state ) )

  }
github holochain / n3h / tools / busychat / index.js View on Github external
_ipcSend (data) {
    let msg = Buffer.from(JSON.stringify(data), 'utf8')
    msg = msgpack.encode({ name: 'json', data: msg }).toString('base64')
    this._ipc.send(Array.from(this._ipc.keys()), msg)
  }
github holochain / n3h / lib / hackmode / p2p-backend-hackmode-peer.js View on Github external
async _sendByCId (cIdList, msgId, fromPeerAddress, peerAddressList, type, data) {
    if (!(data instanceof Buffer)) {
      throw new Error('data must be a Buffer')
    }
    return this._con.send(cIdList, msgpack.encode([
      msgId, fromPeerAddress, peerAddressList, type, data]).toString('base64'))
  }

msgpack-lite

Fast Pure JavaScript MessagePack Encoder and Decoder

MIT
Latest version published 8 years ago

Package Health Score

67 / 100
Full package analysis

Popular msgpack-lite functions