Fixed onConnect and onDisconnect handlers

onConnect and onDisconnect didn't work when using socket.io
instead of raw websockets.