Improved socketio code on the server-side.