Skip to content

Instantly share code, notes, and snippets.

@juliangruber
Last active March 24, 2021 02:00
Show Gist options
  • Select an option

  • Save juliangruber/7877042 to your computer and use it in GitHub Desktop.

Select an option

Save juliangruber/7877042 to your computer and use it in GitHub Desktop.

Revisions

  1. juliangruber revised this gist Dec 9, 2013. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,6 @@ var server = new Server({ port: argv.port });
    server.on('connection', function(ws) {
    var stream = Stream(ws);
    var ps = spawn(argv._[0], argv._.slice(1));
    stream.pipe(ps.stdin);
    ps.stdout.pipe(stream);
    ps.stdout.pipe(stream).pipe(ps.stdin);
    stream.on('end', ps.kill.bind(ps));
    });
  2. juliangruber revised this gist Dec 9, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ var server = new Server({ port: argv.port });
    server.on('connection', function(ws) {
    var stream = Stream(ws);
    var ps = spawn(argv._[0], argv._.slice(1));
    stream.pipe(process.stdin);
    process.stdout.pipe(stream);
    stream.pipe(ps.stdin);
    ps.stdout.pipe(stream);
    stream.on('end', ps.kill.bind(ps));
    });
  3. juliangruber revised this gist Dec 9, 2013. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,6 @@

    # node-websocketd

    A lightweight node port of [websocketd](https://github.com/joewalnes/websocketd), written in go.
    A lightweight node port of [websocketd](https://github.com/joewalnes/websocketd), originally written in go.

    ## Usage

  4. juliangruber created this gist Dec 9, 2013.
    10 changes: 10 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@

    # node-websocketd

    A lightweight node port of [websocketd](https://github.com/joewalnes/websocketd), written in go.

    ## Usage

    ```bash
    node-websocketd --port=8080 ./count.sh
    ```
    14 changes: 14 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    var spawn = require('child_process').spawn;
    var Server = require('ws').Server;
    var Stream = require('websocket-stream');
    var argv = require('optimist').argv;

    var server = new Server({ port: argv.port });

    server.on('connection', function(ws) {
    var stream = Stream(ws);
    var ps = spawn(argv._[0], argv._.slice(1));
    stream.pipe(process.stdin);
    process.stdout.pipe(stream);
    stream.on('end', ps.kill.bind(ps));
    });