jschan
jschan is a JavaScript port of libchan based around node streams
Status
The jschan API should be stable at this point, but libchan is a developing standard and there may be breaking changes in future.
When used over the standard SPDY transport, jschan is compatible with the current Go reference implementation.
We also have a websocket transport to allow us to run jschan on the browser. This feature is not covered by the spec, and is not compatible with other implementations.
Install
npm install jschan-spdy --save
Example
This example exposes a service over SPDY. It is built to be interoperable with the original libchan version rexec.
Server
The server opens up a jschan server to accept new sessions, and then execute the requests that comes through the channel.
'use strict'; var jschan = ;var childProcess = ;var server = server; server; { var child = childProcess; reqStdin; childstdout; childstderr; child;} { channel;} { session;} server;
Client
'use strict'; var usage = processargv0 + ' ' + processargv1 + ' command <args..>'; if !processargv2 console process var jschan = ;var session = ;var sender = session; var cmd = Args: processargv Cmd: processargv2 StatusChan: sender Stderr: processstderr Stdout: processstdout Stdin: processstdin; sender; cmdStatusChan
Contributors
License
MIT