2015-02-06 10:47:40 +01:00
|
|
|
var TcpTransport = require("../lib/net/tcp");
|
2015-02-05 19:38:36 +01:00
|
|
|
|
|
|
|
function start() {
|
2015-02-09 15:38:10 +01:00
|
|
|
var server = new TcpTransport();
|
2015-02-09 22:56:55 +01:00
|
|
|
// In node 0.12/io 1.0 we can use {host: x, port: y} syntax so it'll
|
|
|
|
// be more compatible with the ws transport options.
|
2015-02-09 15:38:10 +01:00
|
|
|
server.listen(22333, "127.0.0.1");
|
|
|
|
server.on("connection", function(client) {
|
|
|
|
client.on("message", function(command, payload) {
|
|
|
|
if (command === "echo-req") {
|
|
|
|
client.send("echo-res", payload);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2015-02-05 19:38:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
start();
|