ServerWebSocket asynchrone handshake method should consume a future instead of a promise - closes #3137

This commit is contained in:
Julien Viet
2019-10-07 18:33:01 +02:00
parent a2369208b7
commit 39cbb5840e
4 changed files with 21 additions and 17 deletions

View File

@@ -689,8 +689,8 @@ public class HTTPExamples {
public void exampleAsynchronousHandshake(HttpServer server) {
server.websocketHandler(websocket -> {
Promise<Integer> promise = Promise.promise();
websocket.setHandshake(promise);
authenticate(websocket, ar -> {
websocket.setHandshake(promise.future());
authenticate(websocket.headers(), ar -> {
if (ar.succeeded()) {
// Terminate the handshake with the status code 101 (Switching Protocol)
// Reject the handshake with 401 (Unauthorized)
@@ -703,7 +703,7 @@ public class HTTPExamples {
});
}
private static void authenticate(ServerWebSocket ws, Handler<AsyncResult<Boolean>> handler) {
private static void authenticate(MultiMap headers, Handler<AsyncResult<Boolean>> handler) {
}