Skip to content

Instantly share code, notes, and snippets.

@sadah
Created January 20, 2013 15:01
Show Gist options
  • Save sadah/4579238 to your computer and use it in GitHub Desktop.
Save sadah/4579238 to your computer and use it in GitHub Desktop.
はじめてのnode.jsで、はじめてのWebSocket。
var ws = require("websocket.io");
var server = ws.listen(8888,
function () {
console.log("ws start");
}
);
server.on("connection",
function(socket) {
socket.on("message",
function(data) {
console.log("message " + data);
server.clients.forEach(
function(client) {
client.send(data);
}
);
}
);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment