refactor server tcp handling

- limit on number of tcp connections
- preliminary support for websockets
This commit is contained in:
Roman Shtylman
2012-10-17 22:50:59 -04:00
parent ab28444802
commit 51d91ce0e8
3 changed files with 252 additions and 169 deletions

12
lib/rand_id.js Normal file
View File

@@ -0,0 +1,12 @@
var chars = 'abcdefghiklmnopqrstuvwxyz';
module.exports = function rand_id() {
var randomstring = '';
for (var i=0; i<4; ++i) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars[rnum];
}
return randomstring;
}