JSPM

sc-codec-min-bin

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 244
  • Score
    100M100P100Q96274F
  • License MIT

Minimal binary codec for SC based on MessagePack

Package Exports

  • sc-codec-min-bin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sc-codec-min-bin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sc-codec-min-bin

Minimal binary codec for SC based on MessagePack.

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

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 you need to set it up properly on both the client and server or else it won't work.


Contributing

To build global script for browser: browserify -s scCodecMinBin index.js > sc-codec-min-bin.js