Created
July 25, 2010 08:08
-
-
Save ThisIsMissEm/489415 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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