Kitura-NIO
Kitura-NIO copied to clipboard
Indicating a failed upgrade to WebSocket via `shouldUpgrade`
The shouldUpgrade
function passed to NIOWebSocket.WebSocketUpgrader
is expected to return an EventLoopFuture<HTTPHeaders?>
to indicate a successful or failed upgrade. On a successful upgrade, we return eventLoop.makeSucceededFuture(httpHeaders)
. But on a failed upgrade (may be because the requested websocket service doesn't exist), it may make sense to return a eventLoop.makeFailedFuture(<error>)
. The questions here are:
a. Does the NIOWebSocket.WebSocketUpgrader
handle an error wrapped in a failed future?
b. What error value do we return?
cc @ianpartridge