socket.io-cbor-x-parser

1.0.3 • Public • Published

socket.io-cbor-x-parser

An alternative to the default socket.io-parser, encoding and decoding packets with cbor-x.

Please note that you MUST use the parser on both sides (server & client).

See also:

Usage

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

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

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

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

Benchmarks

Test MsgPack (Notepack.io) CBOR-X
small json parse 31,431 ops/sec ±4.18% (52 runs sampled) 43,066 ops/sec ±3.39% (77 runs sampled)
big json parse 521 ops/sec ±1.60% (83 runs sampled) 1,280 ops/sec ±2.11% (84 runs sampled)
json with small binary parse 42,144 ops/sec ±2.74% (71 runs sampled) 48,137 ops/sec ±3.10% (78 runs sampled)
json with big binary parse 514 ops/sec ±1.90% (84 runs sampled) 1,240 ops/sec ±1.38% (85 runs sampled)

Benchmark source here.

Readme

Keywords

none

Package Sidebar

Install

npm i socket.io-cbor-x-parser

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

5.73 kB

Total Files

4

Last publish

Collaborators

  • intech