2.3.2 • Published 6 years ago

@unibtc/socket.io-msgpack-parser v2.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

socket.io-msgpack-parser

An alternative to the default socket.io-parser, encoding and decoding packets with @msgpack/msgpack.

With that parser, the browser build will be a bit heavier (an additional 7.5 KB minified, 3.0 KB gzipped), but each message will be smaller (sent as binary).

Recommended

  • NodeJs v12

Required

  • NodeJs v10

Usage

const io = require('socket.io');
const ioc = require('socket.io-client');
const customParser = require('socket.io-msgpack-parser');

let server = io(PORT, {
  parser: customParser
});

let client = ioc('ws://localhost:' + PORT, {
  parser: customParser
});

client.on('connect', () => {
  client.emit('hello');
});