1.0.3 • Published 3 years ago

socket.io-cbor-x-parser v1.0.3

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

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

TestMsgPack (Notepack.io)CBOR-X
small json parse31,431 ops/sec ±4.18% (52 runs sampled)43,066 ops/sec ±3.39% (77 runs sampled)
big json parse521 ops/sec ±1.60% (83 runs sampled)1,280 ops/sec ±2.11% (84 runs sampled)
json with small binary parse42,144 ops/sec ±2.74% (71 runs sampled)48,137 ops/sec ±3.10% (78 runs sampled)
json with big binary parse514 ops/sec ±1.90% (84 runs sampled)1,240 ops/sec ±1.38% (85 runs sampled)

Benchmark source here.

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago