adjusted socket.io code for >1.0