summaryrefslogtreecommitdiffstats
path: root/protoype/app-sio.js
diff options
context:
space:
mode:
Diffstat (limited to 'protoype/app-sio.js')
-rw-r--r--protoype/app-sio.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/protoype/app-sio.js b/protoype/app-sio.js
index 61c9958..9bd4b71 100644
--- a/protoype/app-sio.js
+++ b/protoype/app-sio.js
@@ -113,6 +113,14 @@ sio.sockets.on('connection', function(socket) {
socket.myip = endpoint.address;
socket.myport = endpoint.port;
util.log('[server] new socket.io connection from ' + endpoint.address + ':' + endpoint.port);
+ /* after client logs in, expect him to emit 'login' event, emit should contain tag name and 'logged in' check should be done */
+ socket.on('login', function(tag) {
+ var client = null;
+ if ((client = get_connected_client(tag)) != undefined) {
+ util.log('[socket.io] ' + tag + ' is active');
+ client.tag.iosocket = socket;
+ }
+ });
socket.on('disconnect', function() {
/* delete connected_clients */
util.log('[server] client ' + this.myip + ':' + this.myport + ' disconnected from socket.io connection\n');