Skip to content

Instantly share code, notes, and snippets.

@ThisIsMissEm
Created July 25, 2010 08:08
Show Gist options
  • Save ThisIsMissEm/489415 to your computer and use it in GitHub Desktop.
Save ThisIsMissEm/489415 to your computer and use it in GitHub Desktop.
var ws = require("websocket-server")
, router = require("nws-router");
var server = ws.createServer({
debug: true
});
server.use(router);
// Our events:
server.on('/', function(connection){
});
server.on('/chat/:room', function(connection, params){
connection.storage.push("channels", params["room"]);
// do the various logic.
connection.addListener("message", function(message){
app.send("/chat/"+params["room"], message);
});
});
server.listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment