Remove closures and delegate allocations from WebSocketHandler.