sc-codec-min-bin
Minimal binary codec for SC based on MessagePack
Last updated 3 years ago by topcloudsystems .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install sc-codec-min-bin 
SYNC missed versions from official npm registry.

sc-codec-min-bin

Minimal binary codec for SC based on MessagePack.
This codec helps reduce bandwidth usage and is ideal for games and other high-throughput applications.

This module is designed to be hooked up on both the client and server.

To install, use:

npm install sc-codec-min-bin

On the server, inside worker.js, you should use:

var scCodecMinBin = require('sc-codec-min-bin');

// ...
// This needs to go inside the run function - Near the top.
worker.scServer.setCodecEngine(scCodecMinBin);

On the client-side, you can either include the sc-codec-min-bin module using your favorite bundler such as Browserify or Webpack or you can include the sc-codec-min-bin.js file using a script tag; this will expose the scCodecMinBin object globally. To use it, you just need to add it on connect:

var socket = socketCluster.connect({
  // ...
  codecEngine: scCodecMinBin
});

Note that the codec used on the client and on the server always need to match.


Contributing

To build the global script for the browser:

browserify -s scCodecMinBin index.js > sc-codec-min-bin.js

Current Tags

  • 3.0.0                                ...           latest (3 years ago)

4 Versions

  • 3.0.0                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 5
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |