Correct bugs in event handling on the websocket server