If the handleProtocols attribute is set in the options for WebSocketServer then this function will be called to select a subprotocol otherwise the first subprotocol sent by the client will be returned. The handleProtocols function takes two arguments: a list of subprotocol strings and a callback. The callback takes two arguments: the result and the selected subprotocol. The handleProtocols handler routine should select a subprotocol from the subprotocols first argument based on whatever criteria the application uses and call the callback with first argument set to true and the selected subprotocol string as the second argument. If the application determines that the client subprotocol list does not have a valid subprotocol then it should call the callback with a false first argument. This will cause the handshake to fail with a 404 (not found) error.