Fix Bugs and simplify WebSocketServer implementation