2015-02-09 22:56:55 +01:00
|
|
|
var WsTransport = require("../lib/net/ws");
|
|
|
|
|
|
|
|
function start() {
|
|
|
|
var server = new WsTransport();
|
|
|
|
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();
|