shoe2
binary-safe streaming sockjs for node and the browser
This package is like shoe, but it encodes and decodes data as base64 to be binary safe (likeshoe-bin, but it has all the necessary events).
Since shoe-bin is no longer maintained, this package was born.
example
The API is exactly the same as shoe.
browser code:
var shoe = ;var through = ;var stream = ;stream;
server code:
var shoe = ;var http = ;var ecstatic = __dirname + '/static';var server = http;server;var sock =;sock;
browser methods
var shoe =
var stream = shoe(uri, cb)
Return a binary-safe readable/writable stream from the sockjs path uri
.
uri
may be a full uri or just a path.
shoe
will emit a 'connect'
event when the connection is open, but writes
before the connection is open will be buffered just like net.connect()
.
server methods
var shoe =
var sock = shoe(opts={}, cb)
Create a sockjs server, passing through the options from ops
.
If cb
is specified, a listener for the 'connection'
event is set up for
cb(stream)
.
sock.install(server, opts)
Install the socket on server
at opts.prefix
. If opts
is a string, it will
be used as the opts.prefix
.
install
With npm do:
npm install shoe2
license
MIT