updated code based on node-socketio