routes for sockets
O hapless Github wanderer: this is but a work in progress.
A state machine for routing sockets and stuff.
I found when working with socket.io, that:
iosocketson'connection'socketon'this' ;socketon'that' ;socketon'the other thing' ;// ...;
Didn't scale very well. Organization became difficult, and much spaghetti code ensued.
Install with npm:
npm install socketron
Give it a socket.io instance and you're good to go!
var io = require'socket.io'listen80;var socketron = require'socketron';socketroniostate'lobby'default: true // this is where newly connected sockets goon:state'game';