2015-02-09 22:56:55 +01:00
|
|
|
var WsTransport = require("../lib/net/ws");
|
|
|
|
|
|
|
|
function start() {
|
2015-02-23 21:45:32 +01:00
|
|
|
var server = new WsTransport({port: 22334});
|
2015-02-09 22:56:55 +01:00
|
|
|
server.listen({host: "127.0.0.1", port: 22334});
|
|
|
|
server.on("connection", function(client) {
|
|
|
|
client.on("message", function(command, payload) {
|
|
|
|
if (command === "echo-req") {
|
|
|
|
client.send("echo-res", payload);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
start();
|