WebSocketServer: refactoring