Sha256: ed1059de70993b01952ad921cd91c7ef05319a7d64655faf5e52880d02137fe3

Contents?: true

Size: 882 Bytes

Versions: 85

Compression:

Stored size: 882 Bytes

Contents

//Setup a server on port 9999 to accept incomming connections
var io = require('socket.io')();
var rl = require('readline');

var r = rl.createInterface({
  input: process.stdin,
  output: new require('stream').Writable(),
  terminal: false
});

var stdin = process.stdin;

_socket = null;

//stdin.resume();
r.on("line", function(chunk) {
  var res = JSON.parse(chunk.toString());
  type = res.type;
  msg = res.msg;
  _socket.emit(type, msg);
});

io.on('connection', function(socket) {
  _socket = socket;
  console.log("CLIENT CONNECTED");

  socket.on("if_dispatch", function(data) {
    console.log("if_dispatch");
    console.log(JSON.stringify(data));
  });

  socket.on("int_dispatch", function(data) {
    console.log("int_dispatch");
    console.log(JSON.stringify(data));
  });
});
io.listen(9999);

function call() {
  console.log("STARTED");
}
setTimeout(call, 1000);

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
flok-0.0.105 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.103 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.102 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.101 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.100 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.99 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.98 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.97 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.96 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.95 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.94 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.93 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.92 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.91 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.90 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.89 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.88 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.87 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.86 spec/iface/driver/assets/debug_socket_server.js
flok-0.0.85 spec/iface/driver/assets/debug_socket_server.js