Kitura-NIO icon indicating copy to clipboard operation
Kitura-NIO copied to clipboard

Indicating a failed upgrade to WebSocket via `shouldUpgrade`

Open pushkarnk opened this issue 5 years ago • 0 comments

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

pushkarnk avatar Apr 03 '19 18:04 pushkarnk