mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
WebSocket API renaming - closes #3234
This commit is contained in:
@@ -803,6 +803,12 @@ Set to <code>maxRedirects</code> the maximum number of redirection a request can
|
||||
Set the maximum requests allowed in the wait queue, any requests beyond the max size will result in
|
||||
a ConnectionPoolTooBusyException. If the value is set to a negative number then the queue will be unbounded.
|
||||
+++
|
||||
|[[maxWebSocketFrameSize]]`@maxWebSocketFrameSize`|`Number (int)`|+++
|
||||
Set the max WebSocket frame size
|
||||
+++
|
||||
|[[maxWebSocketMessageSize]]`@maxWebSocketMessageSize`|`Number (int)`|+++
|
||||
Set the max WebSocket message size
|
||||
+++
|
||||
|[[maxWebsocketFrameSize]]`@maxWebsocketFrameSize`|`Number (int)`|+++
|
||||
Set the max WebSocket frame size
|
||||
+++
|
||||
@@ -903,11 +909,20 @@ Set the trust options in jks format, aka Java truststore
|
||||
|[[tryUseCompression]]`@tryUseCompression`|`Boolean`|+++
|
||||
Set whether compression is enabled
|
||||
+++
|
||||
|[[tryUsePerFrameWebSocketCompression]]`@tryUsePerFrameWebSocketCompression`|`Boolean`|+++
|
||||
Set whether the client will offer the WebSocket per-frame deflate compression extension.
|
||||
+++
|
||||
|[[tryUsePerFrameWebsocketCompression]]`@tryUsePerFrameWebsocketCompression`|`Boolean`|+++
|
||||
Set whether the client will offer the WebSocket per-frame deflate compression extension.
|
||||
+++
|
||||
|[[tryUsePerMessageWebSocketCompression]]`@tryUsePerMessageWebSocketCompression`|`Boolean`|+++
|
||||
Set whether the client will offer the WebSocket per-message deflate compression extension.
|
||||
+++
|
||||
|[[tryUsePerMessageWebsocketCompression]]`@tryUsePerMessageWebsocketCompression`|`Boolean`|+++
|
||||
Set whether the client will offer the WebSocket per-message deflate compression extension.
|
||||
+++
|
||||
|[[tryWebSocketDeflateFrameCompression]]`@tryWebSocketDeflateFrameCompression`|`Boolean`|+++
|
||||
|
||||
+++
|
||||
|[[tryWebsocketDeflateFrameCompression]]`@tryWebsocketDeflateFrameCompression`|`Boolean`|+++
|
||||
|
||||
@@ -921,12 +936,23 @@ Set whether Netty pooled buffers are enabled
|
||||
|[[verifyHost]]`@verifyHost`|`Boolean`|+++
|
||||
Set whether hostname verification is enabled
|
||||
+++
|
||||
|[[webSocketCompressionAllowClientNoContext]]`@webSocketCompressionAllowClientNoContext`|`Boolean`|+++
|
||||
Set whether the <code>client_no_context_takeover</code> parameter of the WebSocket per-message
|
||||
deflate compression extension will be offered.
|
||||
+++
|
||||
|[[webSocketCompressionLevel]]`@webSocketCompressionLevel`|`Number (int)`|+++
|
||||
Set the WebSocket deflate compression level.
|
||||
+++
|
||||
|[[webSocketCompressionRequestServerNoContext]]`@webSocketCompressionRequestServerNoContext`|`Boolean`|+++
|
||||
Set whether the <code>server_no_context_takeover</code> parameter of the WebSocket per-message
|
||||
deflate compression extension will be offered.
|
||||
+++
|
||||
|[[websocketCompressionAllowClientNoContext]]`@websocketCompressionAllowClientNoContext`|`Boolean`|+++
|
||||
Set whether the <code>client_no_context_takeover</code> parameter of the WebSocket per-message
|
||||
deflate compression extension will be offered.
|
||||
+++
|
||||
|[[websocketCompressionLevel]]`@websocketCompressionLevel`|`Number (int)`|+++
|
||||
Set the Websocket deflate compression level.
|
||||
Set the WebSocket deflate compression level.
|
||||
+++
|
||||
|[[websocketCompressionRequestServerNoContext]]`@websocketCompressionRequestServerNoContext`|`Boolean`|+++
|
||||
Set whether the <code>server_no_context_takeover</code> parameter of the WebSocket per-message
|
||||
@@ -1049,6 +1075,12 @@ Set the maximum length of all headers for HTTP/1.x .
|
||||
|[[maxInitialLineLength]]`@maxInitialLineLength`|`Number (int)`|+++
|
||||
Set the maximum length of the initial line for HTTP/1.x (e.g. <code>"GET / HTTP/1.0"</code>)
|
||||
+++
|
||||
|[[maxWebSocketFrameSize]]`@maxWebSocketFrameSize`|`Number (int)`|+++
|
||||
Set the maximum WebSocket frames size
|
||||
+++
|
||||
|[[maxWebSocketMessageSize]]`@maxWebSocketMessageSize`|`Number (int)`|+++
|
||||
Set the maximum WebSocket message size
|
||||
+++
|
||||
|[[maxWebsocketFrameSize]]`@maxWebsocketFrameSize`|`Number (int)`|+++
|
||||
Set the maximum WebSocket frames size
|
||||
+++
|
||||
@@ -1062,9 +1094,15 @@ Set the key/cert store options in pem format.
|
||||
|[[pemTrustOptions]]`@pemTrustOptions`|`link:dataobjects.html#PemTrustOptions[PemTrustOptions]`|+++
|
||||
Set the trust options in pem format
|
||||
+++
|
||||
|[[perFrameWebSocketCompressionSupported]]`@perFrameWebSocketCompressionSupported`|`Boolean`|+++
|
||||
Enable or disable support for the WebSocket per-frame deflate compression extension.
|
||||
+++
|
||||
|[[perFrameWebsocketCompressionSupported]]`@perFrameWebsocketCompressionSupported`|`Boolean`|+++
|
||||
Enable or disable support for the WebSocket per-frame deflate compression extension.
|
||||
+++
|
||||
|[[perMessageWebSocketCompressionSupported]]`@perMessageWebSocketCompressionSupported`|`Boolean`|+++
|
||||
Enable or disable support for WebSocket per-message deflate compression extension.
|
||||
+++
|
||||
|[[perMessageWebsocketCompressionSupported]]`@perMessageWebsocketCompressionSupported`|`Boolean`|+++
|
||||
Enable or disable support for WebSocket per-message deflate compression extension.
|
||||
+++
|
||||
@@ -1133,6 +1171,20 @@ Set the ALPN usage.
|
||||
|[[usePooledBuffers]]`@usePooledBuffers`|`Boolean`|+++
|
||||
Set whether Netty pooled buffers are enabled
|
||||
+++
|
||||
|[[webSocketAllowServerNoContext]]`@webSocketAllowServerNoContext`|`Boolean`|+++
|
||||
Set whether the WebSocket server will accept the <code>server_no_context_takeover</code> parameter of the per-message
|
||||
deflate compression extension offered by the client.
|
||||
+++
|
||||
|[[webSocketCompressionLevel]]`@webSocketCompressionLevel`|`Number (int)`|+++
|
||||
Set the WebSocket compression level.
|
||||
+++
|
||||
|[[webSocketPreferredClientNoContext]]`@webSocketPreferredClientNoContext`|`Boolean`|+++
|
||||
Set whether the WebSocket server will accept the <code>client_no_context_takeover</code> parameter of the per-message
|
||||
deflate compression extension offered by the client.
|
||||
+++
|
||||
|[[webSocketSubProtocols]]`@webSocketSubProtocols`|`Array of String`|+++
|
||||
Set the WebSocket list of sub-protocol supported by the server.
|
||||
+++
|
||||
|[[websocketAllowServerNoContext]]`@websocketAllowServerNoContext`|`Boolean`|+++
|
||||
Set whether the WebSocket server will accept the <code>server_no_context_takeover</code> parameter of the per-message
|
||||
deflate compression extension offered by the client.
|
||||
|
||||
@@ -665,7 +665,7 @@ the pushed response can be written after.
|
||||
|
||||
You can set an {@link io.vertx.core.http.HttpServer#exceptionHandler(io.vertx.core.Handler)} to receive any
|
||||
exceptions that happens before the connection is passed to the {@link io.vertx.core.http.HttpServer#requestHandler(io.vertx.core.Handler)}
|
||||
or to the {@link io.vertx.core.http.HttpServer#websocketHandler(io.vertx.core.Handler)}, e.g during the TLS handshake.
|
||||
or to the {@link io.vertx.core.http.HttpServer#webSocketHandler(io.vertx.core.Handler)}, e.g during the TLS handshake.
|
||||
|
||||
=== HTTP Compression
|
||||
|
||||
@@ -1594,7 +1594,7 @@ There are two ways of handling WebSockets on the server side.
|
||||
|
||||
===== WebSocket handler
|
||||
|
||||
The first way involves providing a {@link io.vertx.core.http.HttpServer#websocketHandler(io.vertx.core.Handler)}
|
||||
The first way involves providing a {@link io.vertx.core.http.HttpServer#webSocketHandler(io.vertx.core.Handler)}
|
||||
on the server instance.
|
||||
|
||||
When a WebSocket connection is made to the server, the handler will be called, passing in an instance of
|
||||
@@ -1662,8 +1662,8 @@ If you wish to write a single WebSocket message to the WebSocket you can do this
|
||||
{@link examples.HTTPExamples#example55}
|
||||
----
|
||||
|
||||
If the WebSocket message is larger than the maximum websocket frame size as configured with
|
||||
{@link io.vertx.core.http.HttpClientOptions#setMaxWebsocketFrameSize(int)}
|
||||
If the WebSocket message is larger than the maximum WebSocket frame size as configured with
|
||||
{@link io.vertx.core.http.HttpClientOptions#setMaxWebSocketFrameSize(int)}
|
||||
then Vert.x will split it into multiple WebSocket frames before sending it on the wire.
|
||||
|
||||
==== Writing frames to WebSockets
|
||||
@@ -1686,7 +1686,7 @@ Here's an example for binary frames:
|
||||
{@link examples.HTTPExamples#example56}
|
||||
----
|
||||
|
||||
In many cases you just want to send a websocket message that consists of a single final frame, so we provide a couple
|
||||
In many cases you just want to send a WebSocket message that consists of a single final frame, so we provide a couple
|
||||
of shortcut methods to do that with {@link io.vertx.core.http.WebSocket#writeFinalBinaryFrame(io.vertx.core.buffer.Buffer)}
|
||||
and {@link io.vertx.core.http.WebSocket#writeFinalTextFrame(String)}.
|
||||
|
||||
|
||||
@@ -114,6 +114,16 @@ import java.time.format.DateTimeFormatter;
|
||||
obj.setMaxWaitQueueSize(((Number)member.getValue()).intValue());
|
||||
}
|
||||
break;
|
||||
case "maxWebSocketFrameSize":
|
||||
if (member.getValue() instanceof Number) {
|
||||
obj.setMaxWebSocketFrameSize(((Number)member.getValue()).intValue());
|
||||
}
|
||||
break;
|
||||
case "maxWebSocketMessageSize":
|
||||
if (member.getValue() instanceof Number) {
|
||||
obj.setMaxWebSocketMessageSize(((Number)member.getValue()).intValue());
|
||||
}
|
||||
break;
|
||||
case "maxWebsocketFrameSize":
|
||||
if (member.getValue() instanceof Number) {
|
||||
obj.setMaxWebsocketFrameSize(((Number)member.getValue()).intValue());
|
||||
@@ -154,16 +164,28 @@ import java.time.format.DateTimeFormatter;
|
||||
obj.setTryUseCompression((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "tryUsePerFrameWebSocketCompression":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setTryUsePerFrameWebSocketCompression((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "tryUsePerFrameWebsocketCompression":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setTryUsePerFrameWebsocketCompression((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "tryUsePerMessageWebSocketCompression":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setTryUsePerMessageWebSocketCompression((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "tryUsePerMessageWebsocketCompression":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setTryUsePerMessageWebsocketCompression((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "tryWebSocketDeflateFrameCompression":
|
||||
break;
|
||||
case "tryWebsocketDeflateFrameCompression":
|
||||
break;
|
||||
case "verifyHost":
|
||||
@@ -171,6 +193,21 @@ import java.time.format.DateTimeFormatter;
|
||||
obj.setVerifyHost((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "webSocketCompressionAllowClientNoContext":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setWebSocketCompressionAllowClientNoContext((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "webSocketCompressionLevel":
|
||||
if (member.getValue() instanceof Number) {
|
||||
obj.setWebSocketCompressionLevel(((Number)member.getValue()).intValue());
|
||||
}
|
||||
break;
|
||||
case "webSocketCompressionRequestServerNoContext":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setWebSocketCompressionRequestServerNoContext((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "websocketCompressionAllowClientNoContext":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setWebsocketCompressionAllowClientNoContext((Boolean)member.getValue());
|
||||
@@ -222,6 +259,8 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("maxPoolSize", obj.getMaxPoolSize());
|
||||
json.put("maxRedirects", obj.getMaxRedirects());
|
||||
json.put("maxWaitQueueSize", obj.getMaxWaitQueueSize());
|
||||
json.put("maxWebSocketFrameSize", obj.getMaxWebSocketFrameSize());
|
||||
json.put("maxWebSocketMessageSize", obj.getMaxWebSocketMessageSize());
|
||||
json.put("maxWebsocketFrameSize", obj.getMaxWebsocketFrameSize());
|
||||
json.put("maxWebsocketMessageSize", obj.getMaxWebsocketMessageSize());
|
||||
json.put("pipelining", obj.isPipelining());
|
||||
@@ -232,9 +271,14 @@ import java.time.format.DateTimeFormatter;
|
||||
}
|
||||
json.put("sendUnmaskedFrames", obj.isSendUnmaskedFrames());
|
||||
json.put("tryUseCompression", obj.isTryUseCompression());
|
||||
json.put("tryUsePerMessageWebSocketCompression", obj.getTryUsePerMessageWebSocketCompression());
|
||||
json.put("tryUsePerMessageWebsocketCompression", obj.getTryUsePerMessageWebsocketCompression());
|
||||
json.put("tryWebSocketDeflateFrameCompression", obj.getTryWebSocketDeflateFrameCompression());
|
||||
json.put("tryWebsocketDeflateFrameCompression", obj.getTryWebsocketDeflateFrameCompression());
|
||||
json.put("verifyHost", obj.isVerifyHost());
|
||||
json.put("webSocketCompressionAllowClientNoContext", obj.getWebSocketCompressionAllowClientNoContext());
|
||||
json.put("webSocketCompressionLevel", obj.getWebSocketCompressionLevel());
|
||||
json.put("webSocketCompressionRequestServerNoContext", obj.getWebSocketCompressionRequestServerNoContext());
|
||||
json.put("websocketCompressionAllowClientNoContext", obj.getWebsocketCompressionAllowClientNoContext());
|
||||
json.put("websocketCompressionLevel", obj.getWebsocketCompressionLevel());
|
||||
json.put("websocketCompressionRequestServerNoContext", obj.getWebsocketCompressionRequestServerNoContext());
|
||||
|
||||
@@ -79,6 +79,16 @@ import java.time.format.DateTimeFormatter;
|
||||
obj.setMaxInitialLineLength(((Number)member.getValue()).intValue());
|
||||
}
|
||||
break;
|
||||
case "maxWebSocketFrameSize":
|
||||
if (member.getValue() instanceof Number) {
|
||||
obj.setMaxWebSocketFrameSize(((Number)member.getValue()).intValue());
|
||||
}
|
||||
break;
|
||||
case "maxWebSocketMessageSize":
|
||||
if (member.getValue() instanceof Number) {
|
||||
obj.setMaxWebSocketMessageSize(((Number)member.getValue()).intValue());
|
||||
}
|
||||
break;
|
||||
case "maxWebsocketFrameSize":
|
||||
if (member.getValue() instanceof Number) {
|
||||
obj.setMaxWebsocketFrameSize(((Number)member.getValue()).intValue());
|
||||
@@ -89,16 +99,51 @@ import java.time.format.DateTimeFormatter;
|
||||
obj.setMaxWebsocketMessageSize(((Number)member.getValue()).intValue());
|
||||
}
|
||||
break;
|
||||
case "perFrameWebSocketCompressionSupported":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setPerFrameWebSocketCompressionSupported((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "perFrameWebsocketCompressionSupported":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setPerFrameWebsocketCompressionSupported((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "perMessageWebSocketCompressionSupported":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setPerMessageWebSocketCompressionSupported((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "perMessageWebsocketCompressionSupported":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setPerMessageWebsocketCompressionSupported((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "webSocketAllowServerNoContext":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setWebSocketAllowServerNoContext((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "webSocketCompressionLevel":
|
||||
if (member.getValue() instanceof Number) {
|
||||
obj.setWebSocketCompressionLevel(((Number)member.getValue()).intValue());
|
||||
}
|
||||
break;
|
||||
case "webSocketPreferredClientNoContext":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setWebSocketPreferredClientNoContext((Boolean)member.getValue());
|
||||
}
|
||||
break;
|
||||
case "webSocketSubProtocols":
|
||||
if (member.getValue() instanceof JsonArray) {
|
||||
java.util.ArrayList<java.lang.String> list = new java.util.ArrayList<>();
|
||||
((Iterable<Object>)member.getValue()).forEach( item -> {
|
||||
if (item instanceof String)
|
||||
list.add((String)item);
|
||||
});
|
||||
obj.setWebSocketSubProtocols(list);
|
||||
}
|
||||
break;
|
||||
case "websocketAllowServerNoContext":
|
||||
if (member.getValue() instanceof Boolean) {
|
||||
obj.setWebsocketAllowServerNoContext((Boolean)member.getValue());
|
||||
@@ -146,10 +191,22 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("maxChunkSize", obj.getMaxChunkSize());
|
||||
json.put("maxHeaderSize", obj.getMaxHeaderSize());
|
||||
json.put("maxInitialLineLength", obj.getMaxInitialLineLength());
|
||||
json.put("maxWebSocketFrameSize", obj.getMaxWebSocketFrameSize());
|
||||
json.put("maxWebSocketMessageSize", obj.getMaxWebSocketMessageSize());
|
||||
json.put("maxWebsocketFrameSize", obj.getMaxWebsocketFrameSize());
|
||||
json.put("maxWebsocketMessageSize", obj.getMaxWebsocketMessageSize());
|
||||
json.put("perFrameWebSocketCompressionSupported", obj.getPerFrameWebSocketCompressionSupported());
|
||||
json.put("perFrameWebsocketCompressionSupported", obj.getPerFrameWebsocketCompressionSupported());
|
||||
json.put("perMessageWebSocketCompressionSupported", obj.getPerMessageWebSocketCompressionSupported());
|
||||
json.put("perMessageWebsocketCompressionSupported", obj.getPerMessageWebsocketCompressionSupported());
|
||||
json.put("webSocketAllowServerNoContext", obj.getWebSocketAllowServerNoContext());
|
||||
json.put("webSocketCompressionLevel", obj.getWebSocketCompressionLevel());
|
||||
json.put("webSocketPreferredClientNoContext", obj.getWebSocketPreferredClientNoContext());
|
||||
if (obj.getWebSocketSubProtocols() != null) {
|
||||
JsonArray array = new JsonArray();
|
||||
obj.getWebSocketSubProtocols().forEach(item -> array.add(item));
|
||||
json.put("webSocketSubProtocols", array);
|
||||
}
|
||||
json.put("websocketAllowServerNoContext", obj.getWebsocketAllowServerNoContext());
|
||||
json.put("websocketCompressionLevel", obj.getWebsocketCompressionLevel());
|
||||
json.put("websocketPreferredClientNoContext", obj.getWebsocketPreferredClientNoContext());
|
||||
|
||||
@@ -37,7 +37,7 @@ public class HTTPExamples {
|
||||
|
||||
public void example2(Vertx vertx) {
|
||||
|
||||
HttpServerOptions options = new HttpServerOptions().setMaxWebsocketFrameSize(1000000);
|
||||
HttpServerOptions options = new HttpServerOptions().setMaxWebSocketFrameSize(1000000);
|
||||
|
||||
HttpServer server = vertx.createHttpServer(options);
|
||||
}
|
||||
@@ -670,16 +670,16 @@ public class HTTPExamples {
|
||||
|
||||
public void example51(HttpServer server) {
|
||||
|
||||
server.websocketHandler(websocket -> {
|
||||
server.webSocketHandler(webSocket -> {
|
||||
System.out.println("Connected!");
|
||||
});
|
||||
}
|
||||
|
||||
public void example52(HttpServer server) {
|
||||
|
||||
server.websocketHandler(websocket -> {
|
||||
if (websocket.path().equals("/myapi")) {
|
||||
websocket.reject();
|
||||
server.webSocketHandler(webSocket -> {
|
||||
if (webSocket.path().equals("/myapi")) {
|
||||
webSocket.reject();
|
||||
} else {
|
||||
// Do something
|
||||
}
|
||||
@@ -687,10 +687,10 @@ public class HTTPExamples {
|
||||
}
|
||||
|
||||
public void exampleAsynchronousHandshake(HttpServer server) {
|
||||
server.websocketHandler(websocket -> {
|
||||
server.webSocketHandler(webSocket -> {
|
||||
Promise<Integer> promise = Promise.promise();
|
||||
websocket.setHandshake(promise.future());
|
||||
authenticate(websocket.headers(), 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)
|
||||
@@ -712,7 +712,7 @@ public class HTTPExamples {
|
||||
server.requestHandler(request -> {
|
||||
if (request.path().equals("/myapi")) {
|
||||
|
||||
ServerWebSocket websocket = request.upgrade();
|
||||
ServerWebSocket webSocket = request.upgrade();
|
||||
// Do something
|
||||
|
||||
} else {
|
||||
@@ -731,47 +731,47 @@ public class HTTPExamples {
|
||||
});
|
||||
}
|
||||
|
||||
public void example55(WebSocket websocket) {
|
||||
public void example55(WebSocket webSocket) {
|
||||
// Write a simple binary message
|
||||
Buffer buffer = Buffer.buffer().appendInt(123).appendFloat(1.23f);
|
||||
websocket.writeBinaryMessage(buffer);
|
||||
webSocket.writeBinaryMessage(buffer);
|
||||
|
||||
// Write a simple text message
|
||||
String message = "hello";
|
||||
websocket.writeTextMessage(message);
|
||||
webSocket.writeTextMessage(message);
|
||||
}
|
||||
|
||||
public void example56(WebSocket websocket, Buffer buffer1, Buffer buffer2, Buffer buffer3) {
|
||||
public void example56(WebSocket webSocket, Buffer buffer1, Buffer buffer2, Buffer buffer3) {
|
||||
|
||||
WebSocketFrame frame1 = WebSocketFrame.binaryFrame(buffer1, false);
|
||||
websocket.writeFrame(frame1);
|
||||
webSocket.writeFrame(frame1);
|
||||
|
||||
WebSocketFrame frame2 = WebSocketFrame.continuationFrame(buffer2, false);
|
||||
websocket.writeFrame(frame2);
|
||||
webSocket.writeFrame(frame2);
|
||||
|
||||
// Write the final frame
|
||||
WebSocketFrame frame3 = WebSocketFrame.continuationFrame(buffer2, true);
|
||||
websocket.writeFrame(frame3);
|
||||
webSocket.writeFrame(frame3);
|
||||
|
||||
}
|
||||
|
||||
public void example56_1(WebSocket websocket) {
|
||||
public void example56_1(WebSocket webSocket) {
|
||||
|
||||
// Send a websocket messages consisting of a single final text frame:
|
||||
// Send a WebSocket messages consisting of a single final text frame:
|
||||
|
||||
websocket.writeFinalTextFrame("Geronimo!");
|
||||
webSocket.writeFinalTextFrame("Geronimo!");
|
||||
|
||||
// Send a websocket messages consisting of a single final binary frame:
|
||||
// Send a WebSocket messages consisting of a single final binary frame:
|
||||
|
||||
Buffer buff = Buffer.buffer().appendInt(12).appendString("foo");
|
||||
|
||||
websocket.writeFinalBinaryFrame(buff);
|
||||
webSocket.writeFinalBinaryFrame(buff);
|
||||
|
||||
}
|
||||
|
||||
public void example57(WebSocket websocket) {
|
||||
public void example57(WebSocket webSocket) {
|
||||
|
||||
websocket.frameHandler(frame -> {
|
||||
webSocket.frameHandler(frame -> {
|
||||
System.out.println("Received a frame of size!");
|
||||
});
|
||||
|
||||
|
||||
@@ -1000,7 +1000,7 @@ public interface HttpClient extends Measured {
|
||||
/**
|
||||
* Connect a WebSocket with the specified options
|
||||
* @param options the request options
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1013,7 +1013,7 @@ public interface HttpClient extends Measured {
|
||||
* @param port the port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(int, String, String, Handler)} instead
|
||||
*/
|
||||
@@ -1024,8 +1024,8 @@ public interface HttpClient extends Measured {
|
||||
/**
|
||||
* Connect a WebSocket with the specified options
|
||||
* @param options the request options
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1038,8 +1038,8 @@ public interface HttpClient extends Measured {
|
||||
* @param port the port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(int, String, String, Handler)} instead
|
||||
*/
|
||||
@@ -1051,7 +1051,7 @@ public interface HttpClient extends Measured {
|
||||
* Connect a WebSocket to the host and relative request URI and default port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(String, String, Handler)} instead
|
||||
*/
|
||||
@@ -1063,8 +1063,8 @@ public interface HttpClient extends Measured {
|
||||
* Connect a WebSocket to the host and relative request URI and default port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(String, String, Handler)} instead
|
||||
*/
|
||||
@@ -1076,7 +1076,7 @@ public interface HttpClient extends Measured {
|
||||
* Connect a WebSocket with the specified options, and with the specified headers
|
||||
* @param options the request options
|
||||
* @param headers the headers
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1090,7 +1090,7 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1102,8 +1102,8 @@ public interface HttpClient extends Measured {
|
||||
* Connect a WebSocket with the specified options, and with the specified headers
|
||||
* @param options the request options
|
||||
* @param headers the headers
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1117,8 +1117,8 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1131,7 +1131,7 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1144,8 +1144,8 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1158,8 +1158,8 @@ public interface HttpClient extends Measured {
|
||||
* the specified version of WebSockets
|
||||
* @param options the request options
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param version the WebSocket version
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1175,8 +1175,8 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param version the WebSocket version
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1190,9 +1190,9 @@ public interface HttpClient extends Measured {
|
||||
* the specified version of WebSockets
|
||||
* @param options the request options
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param version the WebSocket version
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1208,9 +1208,9 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param version the WebSocket version
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1225,8 +1225,8 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param version the WebSocket version
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1241,9 +1241,9 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param version the WebSocket version
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1254,12 +1254,12 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Connect a WebSocket with the specified options, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols
|
||||
* @param options the request options
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1270,14 +1270,14 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Connect a WebSocket to the specified port, host and relative request URI, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols
|
||||
* @param port the port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1288,14 +1288,14 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Connect a WebSocket with the specified absolute url, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols.
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols.
|
||||
*
|
||||
* @param url the absolute url
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1305,13 +1305,13 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Connect a WebSocket with the specified options, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols
|
||||
* @param options the request options
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1322,15 +1322,15 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Connect a WebSocket to the specified port, host and relative request URI, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols
|
||||
* @param port the port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1341,13 +1341,13 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Connect a WebSocket to the specified host, relative request URI and default port, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1358,14 +1358,14 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Connect a WebSocket to the specified host, relative request URI and default port, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1377,7 +1377,7 @@ public interface HttpClient extends Measured {
|
||||
/**
|
||||
* Connect a WebSocket at the relative request URI using the default host and port
|
||||
* @param requestURI the relative URI
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(String, Handler)} instead
|
||||
*/
|
||||
@@ -1388,8 +1388,8 @@ public interface HttpClient extends Measured {
|
||||
/**
|
||||
* Connect a WebSocket at the relative request URI using the default host and port
|
||||
* @param requestURI the relative URI
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(String, Handler)} instead
|
||||
*/
|
||||
@@ -1401,7 +1401,7 @@ public interface HttpClient extends Measured {
|
||||
* Connect a WebSocket at the relative request URI using the default host and port and the specified headers
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1413,8 +1413,8 @@ public interface HttpClient extends Measured {
|
||||
* Connect a WebSocket at the relative request URI using the default host and port and the specified headers
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1427,8 +1427,8 @@ public interface HttpClient extends Measured {
|
||||
* specified version of WebSockets
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param version the WebSocket version
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1442,9 +1442,9 @@ public interface HttpClient extends Measured {
|
||||
* specified version of WebSockets
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param version the WebSocket version
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1459,9 +1459,9 @@ public interface HttpClient extends Measured {
|
||||
* specified version of WebSockets and the specified sub protocols
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1475,10 +1475,10 @@ public interface HttpClient extends Measured {
|
||||
* specified version of WebSockets and the specified sub protocols
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols
|
||||
* @param wsConnect handler that will be called with the websocket when connected
|
||||
* @param failureHandler handler that will be called if websocket connection fails
|
||||
* @param wsConnect handler that will be called with the WebSocket when connected
|
||||
* @param failureHandler handler that will be called if WebSocket connection fails
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@@ -1493,7 +1493,7 @@ public interface HttpClient extends Measured {
|
||||
* @param port the port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param handler handler that will be called with the websocket when connected
|
||||
* @param handler handler that will be called with the WebSocket when connected
|
||||
*/
|
||||
void webSocket(int port, String host, String requestURI, Handler<AsyncResult<WebSocket>> handler);
|
||||
|
||||
@@ -1501,14 +1501,14 @@ public interface HttpClient extends Measured {
|
||||
* Connect a WebSocket to the host and relative request URI and default port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param handler handler that will be called with the websocket when connected
|
||||
* @param handler handler that will be called with the WebSocket when connected
|
||||
*/
|
||||
void webSocket(String host, String requestURI, Handler<AsyncResult<WebSocket>> handler);
|
||||
|
||||
/**
|
||||
* Connect a WebSocket at the relative request URI using the default host and port
|
||||
* @param requestURI the relative URI
|
||||
* @param handler handler that will be called with the websocket when connected
|
||||
* @param handler handler that will be called with the WebSocket when connected
|
||||
*/
|
||||
void webSocket(String requestURI, Handler<AsyncResult<WebSocket>> handler);
|
||||
|
||||
@@ -1521,20 +1521,20 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Connect a WebSocket with the specified absolute url, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols.
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols.
|
||||
*
|
||||
* @param url the absolute url
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @param handler handler that will be called if websocket connection fails
|
||||
* @param handler handler that will be called if WebSocket connection fails
|
||||
*/
|
||||
void webSocketAbs(String url, MultiMap headers, WebsocketVersion version, List<String> subProtocols, Handler<AsyncResult<WebSocket>> handler);
|
||||
|
||||
/**
|
||||
* Create a WebSocket stream with the specified options
|
||||
* @param options the request options
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1545,7 +1545,7 @@ public interface HttpClient extends Measured {
|
||||
* @param port the port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(int, String, String, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1555,7 +1555,7 @@ public interface HttpClient extends Measured {
|
||||
* Create a WebSocket stream to the specified host, relative request URI and default port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(String, String, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1565,7 +1565,7 @@ public interface HttpClient extends Measured {
|
||||
* Create a WebSocket stream with the specified options, and with the specified headers
|
||||
* @param options the request options
|
||||
* @param headers the headers
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1577,7 +1577,7 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1588,7 +1588,7 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1599,8 +1599,8 @@ public interface HttpClient extends Measured {
|
||||
* the specified version of WebSockets
|
||||
* @param options the request options
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @param version the WebSocket version
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1613,8 +1613,8 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @param version the WebSocket version
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1626,8 +1626,8 @@ public interface HttpClient extends Measured {
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @param version the WebSocket version
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1635,13 +1635,13 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Create a WebSocket stream with the specified absolute url, the specified headers, using the specified version of WebSockets,
|
||||
* and the specified websocket sub protocols.
|
||||
* and the specified WebSocket sub protocols.
|
||||
*
|
||||
* @param url the absolute url
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1649,12 +1649,12 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Create a WebSocket stream to the specified port, host and relative request URI, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols
|
||||
* @param options the request options
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1663,14 +1663,14 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Create a WebSocket stream to the specified port, host and relative request URI, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols
|
||||
* @param port the port
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1679,13 +1679,13 @@ public interface HttpClient extends Measured {
|
||||
|
||||
/**
|
||||
* Create a WebSocket stream to the specified host, relative request URI and default port, with the specified headers, using
|
||||
* the specified version of WebSockets, and the specified websocket sub protocols
|
||||
* the specified version of WebSockets, and the specified WebSocket sub protocols
|
||||
* @param host the host
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols to use
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1695,7 +1695,7 @@ public interface HttpClient extends Measured {
|
||||
/**
|
||||
* Create a WebSocket stream at the relative request URI using the default host and port and the specified headers
|
||||
* @param requestURI the relative URI
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(String, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1705,7 +1705,7 @@ public interface HttpClient extends Measured {
|
||||
* Create a WebSocket stream at the relative request URI using the default host and port and the specified headers
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1716,8 +1716,8 @@ public interface HttpClient extends Measured {
|
||||
* specified version of WebSockets
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @param version the WebSocket version
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -1728,9 +1728,9 @@ public interface HttpClient extends Measured {
|
||||
* specified version of WebSockets and the specified sub protocols
|
||||
* @param requestURI the relative URI
|
||||
* @param headers the headers
|
||||
* @param version the websocket version
|
||||
* @param version the WebSocket version
|
||||
* @param subProtocols the subprotocols
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a websocket
|
||||
* @return a stream emitting a WebSocket event when the client connection has been upgraded to a WebSocket
|
||||
* @deprecated use {@link #webSocket(WebSocketConnectOptions, Handler)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
|
||||
@@ -205,8 +205,8 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
private int poolCleanerPeriod;
|
||||
|
||||
private boolean tryUseCompression;
|
||||
private int maxWebsocketFrameSize;
|
||||
private int maxWebsocketMessageSize;
|
||||
private int maxWebSocketFrameSize;
|
||||
private int maxWebSocketMessageSize;
|
||||
private String defaultHost;
|
||||
private int defaultPort;
|
||||
private HttpVersion protocolVersion;
|
||||
@@ -222,11 +222,11 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
private boolean forceSni;
|
||||
private int decoderInitialBufferSize;
|
||||
|
||||
private boolean tryUsePerFrameWebsocketCompression;
|
||||
private boolean tryUsePerMessageWebsocketCompression;
|
||||
private int websocketCompressionLevel;
|
||||
private boolean websocketAllowClientNoContext;
|
||||
private boolean websocketRequestServerNoContext;
|
||||
private boolean tryUsePerFrameWebSocketCompression;
|
||||
private boolean tryUsePerMessageWebSocketCompression;
|
||||
private int webSocketCompressionLevel;
|
||||
private boolean webSocketAllowClientNoContext;
|
||||
private boolean webSocketRequestServerNoContext;
|
||||
|
||||
|
||||
/**
|
||||
@@ -255,8 +255,8 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
this.http2ConnectionWindowSize = other.http2ConnectionWindowSize;
|
||||
this.http2KeepAliveTimeout = other.getHttp2KeepAliveTimeout();
|
||||
this.tryUseCompression = other.isTryUseCompression();
|
||||
this.maxWebsocketFrameSize = other.maxWebsocketFrameSize;
|
||||
this.maxWebsocketMessageSize = other.maxWebsocketMessageSize;
|
||||
this.maxWebSocketFrameSize = other.maxWebSocketFrameSize;
|
||||
this.maxWebSocketMessageSize = other.maxWebSocketMessageSize;
|
||||
this.defaultHost = other.defaultHost;
|
||||
this.defaultPort = other.defaultPort;
|
||||
this.protocolVersion = other.protocolVersion;
|
||||
@@ -272,11 +272,11 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
this.forceSni = other.forceSni;
|
||||
this.decoderInitialBufferSize = other.getDecoderInitialBufferSize();
|
||||
this.poolCleanerPeriod = other.getPoolCleanerPeriod();
|
||||
this.tryUsePerFrameWebsocketCompression = other.tryUsePerFrameWebsocketCompression;
|
||||
this.tryUsePerMessageWebsocketCompression = other.tryUsePerMessageWebsocketCompression;
|
||||
this.websocketAllowClientNoContext = other.websocketAllowClientNoContext;
|
||||
this.websocketCompressionLevel = other.websocketCompressionLevel;
|
||||
this.websocketRequestServerNoContext = other.websocketRequestServerNoContext;
|
||||
this.tryUsePerFrameWebSocketCompression = other.tryUsePerFrameWebSocketCompression;
|
||||
this.tryUsePerMessageWebSocketCompression = other.tryUsePerMessageWebSocketCompression;
|
||||
this.webSocketAllowClientNoContext = other.webSocketAllowClientNoContext;
|
||||
this.webSocketCompressionLevel = other.webSocketCompressionLevel;
|
||||
this.webSocketRequestServerNoContext = other.webSocketRequestServerNoContext;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -313,8 +313,8 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
http2ConnectionWindowSize = DEFAULT_HTTP2_CONNECTION_WINDOW_SIZE;
|
||||
http2KeepAliveTimeout = DEFAULT_HTTP2_KEEP_ALIVE_TIMEOUT;
|
||||
tryUseCompression = DEFAULT_TRY_USE_COMPRESSION;
|
||||
maxWebsocketFrameSize = DEFAULT_MAX_WEBSOCKET_FRAME_SIZE;
|
||||
maxWebsocketMessageSize = DEFAULT_MAX_WEBSOCKET_MESSAGE_SIZE;
|
||||
maxWebSocketFrameSize = DEFAULT_MAX_WEBSOCKET_FRAME_SIZE;
|
||||
maxWebSocketMessageSize = DEFAULT_MAX_WEBSOCKET_MESSAGE_SIZE;
|
||||
defaultHost = DEFAULT_DEFAULT_HOST;
|
||||
defaultPort = DEFAULT_DEFAULT_PORT;
|
||||
protocolVersion = DEFAULT_PROTOCOL_VERSION;
|
||||
@@ -329,11 +329,11 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
maxRedirects = DEFAULT_MAX_REDIRECTS;
|
||||
forceSni = DEFAULT_FORCE_SNI;
|
||||
decoderInitialBufferSize = DEFAULT_DECODER_INITIAL_BUFFER_SIZE;
|
||||
tryUsePerFrameWebsocketCompression = DEFAULT_TRY_USE_PER_FRAME_WEBSOCKET_COMPRESSION;
|
||||
tryUsePerMessageWebsocketCompression = DEFAULT_TRY_USE_PER_MESSAGE_WEBSOCKET_COMPRESSION;
|
||||
websocketCompressionLevel = DEFAULT_WEBSOCKET_COMPRESSION_LEVEL;
|
||||
websocketAllowClientNoContext = DEFAULT_WEBSOCKET_ALLOW_CLIENT_NO_CONTEXT;
|
||||
websocketRequestServerNoContext = DEFAULT_WEBSOCKET_REQUEST_SERVER_NO_CONTEXT;
|
||||
tryUsePerFrameWebSocketCompression = DEFAULT_TRY_USE_PER_FRAME_WEBSOCKET_COMPRESSION;
|
||||
tryUsePerMessageWebSocketCompression = DEFAULT_TRY_USE_PER_MESSAGE_WEBSOCKET_COMPRESSION;
|
||||
webSocketCompressionLevel = DEFAULT_WEBSOCKET_COMPRESSION_LEVEL;
|
||||
webSocketAllowClientNoContext = DEFAULT_WEBSOCKET_ALLOW_CLIENT_NO_CONTEXT;
|
||||
webSocketRequestServerNoContext = DEFAULT_WEBSOCKET_REQUEST_SERVER_NO_CONTEXT;
|
||||
poolCleanerPeriod = DEFAULT_POOL_CLEANER_PERIOD;
|
||||
}
|
||||
|
||||
@@ -791,24 +791,47 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum WebSocket frame size to use
|
||||
*
|
||||
* @return the max WebSocket frame size
|
||||
* @deprecated instead use {@link #getMaxWebSocketFrameSize}
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMaxWebsocketFrameSize() {
|
||||
return maxWebSocketFrameSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum WebSocket frame size to use
|
||||
*
|
||||
* @return the max WebSocket frame size
|
||||
*/
|
||||
public int getMaxWebsocketFrameSize() {
|
||||
return maxWebsocketFrameSize;
|
||||
public int getMaxWebSocketFrameSize() {
|
||||
return maxWebSocketFrameSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the max WebSocket frame size
|
||||
*
|
||||
* @param maxWebsocketFrameSize the max frame size, in bytes
|
||||
* @param maxWebSocketFrameSize the max frame size, in bytes
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setMaxWebSocketFrameSize}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpClientOptions setMaxWebsocketFrameSize(int maxWebSocketFrameSize) {
|
||||
this.maxWebSocketFrameSize = maxWebSocketFrameSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the max WebSocket frame size
|
||||
*
|
||||
* @param maxWebSocketFrameSize the max frame size, in bytes
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpClientOptions setMaxWebsocketFrameSize(int maxWebsocketFrameSize) {
|
||||
this.maxWebsocketFrameSize = maxWebsocketFrameSize;
|
||||
public HttpClientOptions setMaxWebSocketFrameSize(int maxWebSocketFrameSize) {
|
||||
this.maxWebSocketFrameSize = maxWebSocketFrameSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -816,19 +839,43 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
* Get the maximum WebSocket message size to use
|
||||
*
|
||||
* @return the max WebSocket message size
|
||||
* @deprecated instead use {@link #getMaxWebSocketMessageSize}
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMaxWebsocketMessageSize() {
|
||||
return maxWebsocketMessageSize;
|
||||
return maxWebSocketMessageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum WebSocket message size to use
|
||||
*
|
||||
* @return the max WebSocket message size
|
||||
*/
|
||||
public int getMaxWebSocketMessageSize() {
|
||||
return maxWebSocketMessageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the max WebSocket message size
|
||||
*
|
||||
* @param maxWebsocketMessageSize the max message size, in bytes
|
||||
* @param maxWebSocketMessageSize the max message size, in bytes
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setMaxWebSocketMessageSize}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpClientOptions setMaxWebsocketMessageSize(int maxWebSocketMessageSize) {
|
||||
this.maxWebSocketMessageSize = maxWebSocketMessageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the max WebSocket message size
|
||||
*
|
||||
* @param maxWebSocketMessageSize the max message size, in bytes
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpClientOptions setMaxWebsocketMessageSize(int maxWebsocketMessageSize) {
|
||||
this.maxWebsocketMessageSize = maxWebsocketMessageSize;
|
||||
public HttpClientOptions setMaxWebSocketMessageSize(int maxWebSocketMessageSize) {
|
||||
this.maxWebSocketMessageSize = maxWebSocketMessageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1108,104 +1155,208 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
*
|
||||
* @param offer {@code true} to offer the per-frame deflate compression extension
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setTryUsePerFrameWebSocketCompression}
|
||||
*/
|
||||
public HttpClientOptions setTryUsePerFrameWebsocketCompression (boolean offer)
|
||||
{
|
||||
this.tryUsePerFrameWebsocketCompression = offer;
|
||||
return this;
|
||||
}
|
||||
@Deprecated
|
||||
public HttpClientOptions setTryUsePerFrameWebsocketCompression(boolean offer) {
|
||||
this.tryUsePerFrameWebSocketCompression = offer;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the WebSocket per-frame deflate compression extension will be offered
|
||||
*/
|
||||
public boolean getTryWebsocketDeflateFrameCompression()
|
||||
{
|
||||
return this.tryUsePerFrameWebsocketCompression;
|
||||
}
|
||||
/**
|
||||
* Set whether the client will offer the WebSocket per-frame deflate compression extension.
|
||||
*
|
||||
* @param offer {@code true} to offer the per-frame deflate compression extension
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpClientOptions setTryUsePerFrameWebSocketCompression(boolean offer) {
|
||||
this.tryUsePerFrameWebSocketCompression = offer;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the client will offer the WebSocket per-message deflate compression extension.
|
||||
*
|
||||
* @param offer {@code true} to offer the per-message deflate compression extension
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpClientOptions setTryUsePerMessageWebsocketCompression (boolean offer)
|
||||
{
|
||||
this.tryUsePerMessageWebsocketCompression = offer;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @return {@code true} when the WebSocket per-frame deflate compression extension will be offered
|
||||
* @deprecated instead use {@link #getTryWebSocketDeflateFrameCompression}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getTryWebsocketDeflateFrameCompression() {
|
||||
return this.tryUsePerFrameWebSocketCompression;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the WebSocket per-message deflate compression extension will be offered
|
||||
*/
|
||||
public boolean getTryUsePerMessageWebsocketCompression()
|
||||
{
|
||||
return this.tryUsePerMessageWebsocketCompression;
|
||||
}
|
||||
/**
|
||||
* @return {@code true} when the WebSocket per-frame deflate compression extension will be offered
|
||||
*/
|
||||
public boolean getTryWebSocketDeflateFrameCompression() {
|
||||
return this.tryUsePerFrameWebSocketCompression;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Websocket deflate compression level.
|
||||
*
|
||||
* @param compressionLevel the WebSocket deflate compression level
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpClientOptions setWebsocketCompressionLevel (int compressionLevel)
|
||||
{
|
||||
this.websocketCompressionLevel = compressionLevel;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Set whether the client will offer the WebSocket per-message deflate compression extension.
|
||||
*
|
||||
* @param offer {@code true} to offer the per-message deflate compression extension
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setTryUsePerMessageWebSocketCompression}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpClientOptions setTryUsePerMessageWebsocketCompression(boolean offer) {
|
||||
this.tryUsePerMessageWebSocketCompression = offer;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Websocket deflate compression level
|
||||
*/
|
||||
public int getWebsocketCompressionLevel()
|
||||
{
|
||||
return this.websocketCompressionLevel;
|
||||
}
|
||||
/**
|
||||
* Set whether the client will offer the WebSocket per-message deflate compression extension.
|
||||
*
|
||||
* @param offer {@code true} to offer the per-message deflate compression extension
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpClientOptions setTryUsePerMessageWebSocketCompression(boolean offer) {
|
||||
this.tryUsePerMessageWebSocketCompression = offer;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the WebSocket per-message deflate compression extension will be offered
|
||||
* @deprecated instead use {@link #getTryUsePerMessageWebSocketCompression}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getTryUsePerMessageWebsocketCompression() {
|
||||
return this.tryUsePerMessageWebSocketCompression;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the WebSocket per-message deflate compression extension will be offered
|
||||
*/
|
||||
public boolean getTryUsePerMessageWebSocketCompression() {
|
||||
return this.tryUsePerMessageWebSocketCompression;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the WebSocket deflate compression level.
|
||||
*
|
||||
* @param compressionLevel the WebSocket deflate compression level
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setWebSocketCompressionLevel}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpClientOptions setWebsocketCompressionLevel(int compressionLevel) {
|
||||
this.webSocketCompressionLevel = compressionLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the WebSocket deflate compression level.
|
||||
*
|
||||
* @param compressionLevel the WebSocket deflate compression level
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpClientOptions setWebSocketCompressionLevel(int compressionLevel) {
|
||||
this.webSocketCompressionLevel = compressionLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the WebSocket deflate compression level
|
||||
* @deprecated instead use {@link #getWebSocketCompressionLevel}
|
||||
*/
|
||||
@Deprecated
|
||||
public int getWebsocketCompressionLevel() {
|
||||
return this.webSocketCompressionLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the WebSocket deflate compression level
|
||||
*/
|
||||
public int getWebSocketCompressionLevel() {
|
||||
return this.webSocketCompressionLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the {@code client_no_context_takeover} parameter of the WebSocket per-message
|
||||
* deflate compression extension will be offered.
|
||||
*
|
||||
* @param offer {@code true} to offer the {@code client_no_context_takeover} parameter
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setWebSocketCompressionAllowClientNoContext}
|
||||
*/
|
||||
public HttpClientOptions setWebsocketCompressionAllowClientNoContext(boolean offer)
|
||||
{
|
||||
this.websocketAllowClientNoContext = offer;
|
||||
return this;
|
||||
}
|
||||
@Deprecated
|
||||
public HttpClientOptions setWebsocketCompressionAllowClientNoContext(boolean offer) {
|
||||
this.webSocketAllowClientNoContext = offer;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the {@code client_no_context_takeover} parameter of the WebSocket per-message
|
||||
* deflate compression extension will be offered.
|
||||
*
|
||||
* @param offer {@code true} to offer the {@code client_no_context_takeover} parameter
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpClientOptions setWebSocketCompressionAllowClientNoContext(boolean offer) {
|
||||
this.webSocketAllowClientNoContext = offer;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the {@code client_no_context_takeover} parameter for the WebSocket per-message
|
||||
* deflate compression extension will be offered
|
||||
* @deprecated instead use {@link #getWebSocketCompressionAllowClientNoContext}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getWebsocketCompressionAllowClientNoContext() {
|
||||
return this.webSocketAllowClientNoContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the {@code client_no_context_takeover} parameter for the WebSocket per-message
|
||||
* deflate compression extension will be offered
|
||||
*/
|
||||
public boolean getWebsocketCompressionAllowClientNoContext()
|
||||
{
|
||||
return this.websocketAllowClientNoContext;
|
||||
}
|
||||
public boolean getWebSocketCompressionAllowClientNoContext() {
|
||||
return this.webSocketAllowClientNoContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the {@code server_no_context_takeover} parameter of the WebSocket per-message
|
||||
* deflate compression extension will be offered.
|
||||
*
|
||||
* @param offer {@code true} to offer the {@code server_no_context_takeover} parameter
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setWebSocketCompressionRequestServerNoContext}
|
||||
*/
|
||||
public HttpClientOptions setWebsocketCompressionRequestServerNoContext(boolean offer)
|
||||
{
|
||||
this.websocketRequestServerNoContext = offer;
|
||||
return this;
|
||||
}
|
||||
@Deprecated
|
||||
public HttpClientOptions setWebsocketCompressionRequestServerNoContext(boolean offer) {
|
||||
this.webSocketRequestServerNoContext = offer;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the {@code server_no_context_takeover} parameter for the Websocket per-message
|
||||
* Set whether the {@code server_no_context_takeover} parameter of the WebSocket per-message
|
||||
* deflate compression extension will be offered.
|
||||
*
|
||||
* @param offer {@code true} to offer the {@code server_no_context_takeover} parameter
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpClientOptions setWebSocketCompressionRequestServerNoContext(boolean offer) {
|
||||
this.webSocketRequestServerNoContext = offer;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the {@code server_no_context_takeover} parameter for the WebSocket per-message
|
||||
* deflate compression extension will be offered
|
||||
* @deprecated instead use {@link #getWebSocketCompressionRequestServerNoContext}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getWebsocketCompressionRequestServerNoContext() {
|
||||
return this.webSocketRequestServerNoContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the {@code server_no_context_takeover} parameter for the WebSocket per-message
|
||||
* deflate compression extension will be offered
|
||||
*/
|
||||
public boolean getWebsocketCompressionRequestServerNoContext()
|
||||
{
|
||||
return this.websocketRequestServerNoContext;
|
||||
}
|
||||
public boolean getWebSocketCompressionRequestServerNoContext() {
|
||||
return this.webSocketRequestServerNoContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the initial buffer size for the HTTP decoder
|
||||
@@ -1255,8 +1406,8 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
if (keepAlive != that.keepAlive) return false;
|
||||
if (maxPoolSize != that.maxPoolSize) return false;
|
||||
if (http2MultiplexingLimit != that.http2MultiplexingLimit) return false;
|
||||
if (maxWebsocketFrameSize != that.maxWebsocketFrameSize) return false;
|
||||
if (maxWebsocketMessageSize != that.maxWebsocketMessageSize) return false;
|
||||
if (maxWebSocketFrameSize != that.maxWebSocketFrameSize) return false;
|
||||
if (maxWebSocketMessageSize != that.maxWebSocketMessageSize) return false;
|
||||
if (pipelining != that.pipelining) return false;
|
||||
if (pipeliningLimit != that.pipeliningLimit) return false;
|
||||
if (tryUseCompression != that.tryUseCompression) return false;
|
||||
@@ -1276,11 +1427,11 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
if (http2KeepAliveTimeout != that.http2KeepAliveTimeout) return false;
|
||||
if (poolCleanerPeriod != that.poolCleanerPeriod) return false;
|
||||
|
||||
if (tryUsePerFrameWebsocketCompression != that.tryUsePerFrameWebsocketCompression) return false;
|
||||
if (tryUsePerMessageWebsocketCompression != that.tryUsePerMessageWebsocketCompression) return false;
|
||||
if (websocketCompressionLevel != that.websocketCompressionLevel) return false;
|
||||
if (websocketAllowClientNoContext != that.websocketAllowClientNoContext) return false;
|
||||
if (websocketRequestServerNoContext != that.websocketRequestServerNoContext) return false;
|
||||
if (tryUsePerFrameWebSocketCompression != that.tryUsePerFrameWebSocketCompression) return false;
|
||||
if (tryUsePerMessageWebSocketCompression != that.tryUsePerMessageWebSocketCompression) return false;
|
||||
if (webSocketCompressionLevel != that.webSocketCompressionLevel) return false;
|
||||
if (webSocketAllowClientNoContext != that.webSocketAllowClientNoContext) return false;
|
||||
if (webSocketRequestServerNoContext != that.webSocketRequestServerNoContext) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1295,8 +1446,8 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
result = 31 * result + (pipelining ? 1 : 0);
|
||||
result = 31 * result + pipeliningLimit;
|
||||
result = 31 * result + (tryUseCompression ? 1 : 0);
|
||||
result = 31 * result + maxWebsocketFrameSize;
|
||||
result = 31 * result + maxWebsocketMessageSize;
|
||||
result = 31 * result + maxWebSocketFrameSize;
|
||||
result = 31 * result + maxWebSocketMessageSize;
|
||||
result = 31 * result + defaultHost.hashCode();
|
||||
result = 31 * result + defaultPort;
|
||||
result = 31 * result + protocolVersion.hashCode();
|
||||
@@ -1312,11 +1463,11 @@ public class HttpClientOptions extends ClientOptionsBase {
|
||||
result = 31 * result + keepAliveTimeout;
|
||||
result = 31 * result + http2KeepAliveTimeout;
|
||||
result = 31 * result + poolCleanerPeriod;
|
||||
result = 31 * result + (tryUsePerFrameWebsocketCompression ? 1 : 0);
|
||||
result = 31 * result + (tryUsePerMessageWebsocketCompression ? 1 : 0);
|
||||
result = 31 * result + websocketCompressionLevel;
|
||||
result = 31 * result + (websocketAllowClientNoContext ? 1 : 0);
|
||||
result = 31 * result + (websocketRequestServerNoContext ? 1: 0);
|
||||
result = 31 * result + (tryUsePerFrameWebSocketCompression ? 1 : 0);
|
||||
result = 31 * result + (tryUsePerMessageWebSocketCompression ? 1 : 0);
|
||||
result = 31 * result + webSocketCompressionLevel;
|
||||
result = 31 * result + (webSocketAllowClientNoContext ? 1 : 0);
|
||||
result = 31 * result + (webSocketRequestServerNoContext ? 1: 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import io.vertx.core.streams.ReadStream;
|
||||
* You receive HTTP requests by providing a {@link #requestHandler}. As requests arrive on the server the handler
|
||||
* will be called with the requests.
|
||||
* <p>
|
||||
* You receive WebSockets by providing a {@link #websocketHandler}. As WebSocket connections arrive on the server, the
|
||||
* You receive WebSockets by providing a {@link #webSocketHandler}. As WebSocket connections arrive on the server, the
|
||||
* WebSocket is passed to the handler.
|
||||
*
|
||||
* @author <a href="http://tfox.org">Tim Fox</a>
|
||||
@@ -78,28 +78,58 @@ public interface HttpServer extends Measured {
|
||||
HttpServer exceptionHandler(Handler<Throwable> handler);
|
||||
|
||||
/**
|
||||
* Return the websocket stream for the server. If a websocket connect handshake is successful a
|
||||
* Return the WebSocket stream for the server. If a webSocket connect handshake is successful a
|
||||
* new {@link ServerWebSocket} instance will be created and passed to the stream {@link io.vertx.core.streams.ReadStream#handler(io.vertx.core.Handler)}.
|
||||
*
|
||||
* @return the websocket stream
|
||||
* @return the WebSocket stream
|
||||
* @deprecated instead use {@link #webSocketStream()}
|
||||
*/
|
||||
@Deprecated
|
||||
@CacheReturn
|
||||
ReadStream<ServerWebSocket> websocketStream();
|
||||
|
||||
/**
|
||||
* Set the websocket handler for the server to {@code wsHandler}. If a websocket connect handshake is successful a
|
||||
* Return the WebSocket stream for the server. If a WebSocket connect handshake is successful a
|
||||
* new {@link ServerWebSocket} instance will be created and passed to the stream {@link io.vertx.core.streams.ReadStream#handler(io.vertx.core.Handler)}.
|
||||
*
|
||||
* @return the WebSocket stream
|
||||
*/
|
||||
@CacheReturn
|
||||
ReadStream<ServerWebSocket> webSocketStream();
|
||||
|
||||
/**
|
||||
* Set the WebSocket handler for the server to {@code wsHandler}. If a WebSocket connect handshake is successful a
|
||||
* new {@link ServerWebSocket} instance will be created and passed to the handler.
|
||||
*
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use instead {@link #webSocketHandler()}
|
||||
*/
|
||||
@Deprecated
|
||||
@Fluent
|
||||
HttpServer websocketHandler(Handler<ServerWebSocket> handler);
|
||||
|
||||
/**
|
||||
* @return the WebSocket handler
|
||||
* @deprecated use instead {@link #webSocketHandler()}
|
||||
*/
|
||||
@Deprecated
|
||||
@GenIgnore
|
||||
Handler<ServerWebSocket> websocketHandler();
|
||||
|
||||
/**
|
||||
* Set the WebSocket handler for the server to {@code wsHandler}. If a WebSocket connect handshake is successful a
|
||||
* new {@link ServerWebSocket} instance will be created and passed to the handler.
|
||||
*
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
@Fluent
|
||||
HttpServer websocketHandler(Handler<ServerWebSocket> handler);
|
||||
HttpServer webSocketHandler(Handler<ServerWebSocket> handler);
|
||||
|
||||
/**
|
||||
* @return the websocketHandler
|
||||
* @return the WebSocket handler
|
||||
*/
|
||||
@GenIgnore
|
||||
Handler<ServerWebSocket> websocketHandler();
|
||||
Handler<ServerWebSocket> webSocketHandler();
|
||||
|
||||
/**
|
||||
* Tell the server to start listening. The server will listen on the port and host specified in the
|
||||
|
||||
@@ -132,9 +132,9 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
|
||||
private boolean compressionSupported;
|
||||
private int compressionLevel;
|
||||
private int maxWebsocketFrameSize;
|
||||
private int maxWebsocketMessageSize;
|
||||
private String websocketSubProtocols;
|
||||
private int maxWebSocketFrameSize;
|
||||
private int maxWebSocketMessageSize;
|
||||
private List<String> webSocketSubProtocols;
|
||||
private boolean handle100ContinueAutomatically;
|
||||
private int maxChunkSize;
|
||||
private int maxInitialLineLength;
|
||||
@@ -145,11 +145,11 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
private boolean decompressionSupported;
|
||||
private boolean acceptUnmaskedFrames;
|
||||
private int decoderInitialBufferSize;
|
||||
private boolean perFrameWebsocketCompressionSupported;
|
||||
private boolean perMessageWebsocketCompressionSupported;
|
||||
private int websocketCompressionLevel;
|
||||
private boolean websocketAllowServerNoContext;
|
||||
private boolean websocketPreferredClientNoContext;
|
||||
private boolean perFrameWebSocketCompressionSupported;
|
||||
private boolean perMessageWebSocketCompressionSupported;
|
||||
private int webSocketCompressionLevel;
|
||||
private boolean webSocketAllowServerNoContext;
|
||||
private boolean webSocketPreferredClientNoContext;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
@@ -169,9 +169,9 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
super(other);
|
||||
this.compressionSupported = other.isCompressionSupported();
|
||||
this.compressionLevel = other.getCompressionLevel();
|
||||
this.maxWebsocketFrameSize = other.getMaxWebsocketFrameSize();
|
||||
this.maxWebsocketMessageSize = other.getMaxWebsocketMessageSize();
|
||||
this.websocketSubProtocols = other.getWebsocketSubProtocols();
|
||||
this.maxWebSocketFrameSize = other.maxWebSocketFrameSize;
|
||||
this.maxWebSocketMessageSize = other.maxWebSocketMessageSize;
|
||||
this.webSocketSubProtocols = other.webSocketSubProtocols != null ? new ArrayList<>(other.webSocketSubProtocols) : null;
|
||||
this.handle100ContinueAutomatically = other.handle100ContinueAutomatically;
|
||||
this.maxChunkSize = other.getMaxChunkSize();
|
||||
this.maxInitialLineLength = other.getMaxInitialLineLength();
|
||||
@@ -182,11 +182,11 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
this.decompressionSupported = other.isDecompressionSupported();
|
||||
this.acceptUnmaskedFrames = other.isAcceptUnmaskedFrames();
|
||||
this.decoderInitialBufferSize = other.getDecoderInitialBufferSize();
|
||||
this.perFrameWebsocketCompressionSupported = other.perFrameWebsocketCompressionSupported;
|
||||
this.perMessageWebsocketCompressionSupported = other.perMessageWebsocketCompressionSupported;
|
||||
this.websocketCompressionLevel = other.websocketCompressionLevel;
|
||||
this.websocketPreferredClientNoContext = other.websocketPreferredClientNoContext;
|
||||
this.websocketAllowServerNoContext = other.websocketAllowServerNoContext;
|
||||
this.perFrameWebSocketCompressionSupported = other.perFrameWebSocketCompressionSupported;
|
||||
this.perMessageWebSocketCompressionSupported = other.perMessageWebSocketCompressionSupported;
|
||||
this.webSocketCompressionLevel = other.webSocketCompressionLevel;
|
||||
this.webSocketPreferredClientNoContext = other.webSocketPreferredClientNoContext;
|
||||
this.webSocketAllowServerNoContext = other.webSocketAllowServerNoContext;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,8 +215,8 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
private void init() {
|
||||
compressionSupported = DEFAULT_COMPRESSION_SUPPORTED;
|
||||
compressionLevel = DEFAULT_COMPRESSION_LEVEL;
|
||||
maxWebsocketFrameSize = DEFAULT_MAX_WEBSOCKET_FRAME_SIZE;
|
||||
maxWebsocketMessageSize = DEFAULT_MAX_WEBSOCKET_MESSAGE_SIZE;
|
||||
maxWebSocketFrameSize = DEFAULT_MAX_WEBSOCKET_FRAME_SIZE;
|
||||
maxWebSocketMessageSize = DEFAULT_MAX_WEBSOCKET_MESSAGE_SIZE;
|
||||
handle100ContinueAutomatically = DEFAULT_HANDLE_100_CONTINE_AUTOMATICALLY;
|
||||
maxChunkSize = DEFAULT_MAX_CHUNK_SIZE;
|
||||
maxInitialLineLength = DEFAULT_MAX_INITIAL_LINE_LENGTH;
|
||||
@@ -227,11 +227,11 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
decompressionSupported = DEFAULT_DECOMPRESSION_SUPPORTED;
|
||||
acceptUnmaskedFrames = DEFAULT_ACCEPT_UNMASKED_FRAMES;
|
||||
decoderInitialBufferSize = DEFAULT_DECODER_INITIAL_BUFFER_SIZE;
|
||||
perFrameWebsocketCompressionSupported = DEFAULT_PER_FRAME_WEBSOCKET_COMPRESSION_SUPPORTED;
|
||||
perMessageWebsocketCompressionSupported = DEFAULT_PER_MESSAGE_WEBSOCKET_COMPRESSION_SUPPORTED;
|
||||
websocketCompressionLevel = DEFAULT_WEBSOCKET_COMPRESSION_LEVEL;
|
||||
websocketPreferredClientNoContext = DEFAULT_WEBSOCKET_PREFERRED_CLIENT_NO_CONTEXT;
|
||||
websocketAllowServerNoContext = DEFAULT_WEBSOCKET_ALLOW_SERVER_NO_CONTEXT;
|
||||
perFrameWebSocketCompressionSupported = DEFAULT_PER_FRAME_WEBSOCKET_COMPRESSION_SUPPORTED;
|
||||
perMessageWebSocketCompressionSupported = DEFAULT_PER_MESSAGE_WEBSOCKET_COMPRESSION_SUPPORTED;
|
||||
webSocketCompressionLevel = DEFAULT_WEBSOCKET_COMPRESSION_LEVEL;
|
||||
webSocketPreferredClientNoContext = DEFAULT_WEBSOCKET_PREFERRED_CLIENT_NO_CONTEXT;
|
||||
webSocketAllowServerNoContext = DEFAULT_WEBSOCKET_ALLOW_SERVER_NO_CONTEXT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -536,38 +536,82 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum WebSocket frame size
|
||||
* @return the maximum WebSocket frame size
|
||||
* @deprecated use instead {@link #getMaxWebSocketFrameSize()}
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMaxWebsocketFrameSize() {
|
||||
return maxWebsocketFrameSize;
|
||||
return maxWebSocketFrameSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum WebSocket frames size
|
||||
*
|
||||
* @param maxWebsocketFrameSize the maximum frame size in bytes.
|
||||
* @param maxWebSocketFrameSize the maximum frame size in bytes.
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use instead {@link #setMaxWebSocketFrameSize(int)}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpServerOptions setMaxWebsocketFrameSize(int maxWebSocketFrameSize) {
|
||||
this.maxWebSocketFrameSize = maxWebSocketFrameSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum WebSocket frame size
|
||||
*/
|
||||
public int getMaxWebSocketFrameSize() {
|
||||
return maxWebSocketFrameSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum WebSocket frames size
|
||||
*
|
||||
* @param maxWebSocketFrameSize the maximum frame size in bytes.
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpServerOptions setMaxWebsocketFrameSize(int maxWebsocketFrameSize) {
|
||||
this.maxWebsocketFrameSize = maxWebsocketFrameSize;
|
||||
public HttpServerOptions setMaxWebSocketFrameSize(int maxWebSocketFrameSize) {
|
||||
this.maxWebSocketFrameSize = maxWebSocketFrameSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum WebSocket message size
|
||||
* @deprecated use instead {@link #getMaxWebSocketMessageSize()}
|
||||
*/
|
||||
@Deprecated
|
||||
public int getMaxWebsocketMessageSize() {
|
||||
return maxWebSocketMessageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum WebSocket message size
|
||||
*
|
||||
* @param maxWebSocketMessageSize the maximum message size in bytes.
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use instead {@link #setMaxWebSocketMessageSize(int)}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpServerOptions setMaxWebsocketMessageSize(int maxWebSocketMessageSize) {
|
||||
this.maxWebSocketMessageSize = maxWebSocketMessageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum WebSocket message size
|
||||
*/
|
||||
public int getMaxWebsocketMessageSize() {
|
||||
return maxWebsocketMessageSize;
|
||||
public int getMaxWebSocketMessageSize() {
|
||||
return maxWebSocketMessageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum WebSocket message size
|
||||
*
|
||||
* @param maxWebsocketMessageSize the maximum message size in bytes.
|
||||
* @param maxWebSocketMessageSize the maximum message size in bytes.
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpServerOptions setMaxWebsocketMessageSize(int maxWebsocketMessageSize) {
|
||||
this.maxWebsocketMessageSize = maxWebsocketMessageSize;
|
||||
public HttpServerOptions setMaxWebSocketMessageSize(int maxWebSocketMessageSize) {
|
||||
this.maxWebSocketMessageSize = maxWebSocketMessageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -576,17 +620,52 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
*
|
||||
* @param subProtocols comma separated list of subprotocols
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated use {@link #setWebSocketSubProtocols(List)} or {@link #addWebSocketSubProtocol(String)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpServerOptions setWebsocketSubProtocols(String subProtocols) {
|
||||
websocketSubProtocols = subProtocols;
|
||||
return this;
|
||||
return setWebSocketSubProtocols(subProtocols == null ? null : new ArrayList<>(Arrays.asList(subProtocols.split("\\s*,\\s*"))));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Get the WebSocket sub-protocols
|
||||
* @deprecated use {@link #getWebSocketSubProtocols()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public String getWebsocketSubProtocols() {
|
||||
return websocketSubProtocols;
|
||||
return getWebSocketSubProtocols() != null ? String.join(",", getWebSocketSubProtocols()) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a WebSocket sub-protocol to the list supported by the server.
|
||||
*
|
||||
* @param subProtocol the sub-protocol to add
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpServerOptions addWebSocketSubProtocol(String subProtocol) {
|
||||
Objects.requireNonNull(subProtocol, "Cannot add a null WebSocket sub-protocol");
|
||||
if (webSocketSubProtocols == null) {
|
||||
webSocketSubProtocols = new ArrayList<>();
|
||||
}
|
||||
webSocketSubProtocols.add(subProtocol);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Set the WebSocket list of sub-protocol supported by the server.
|
||||
*
|
||||
* @param subProtocols comma separated list of sub-protocols
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpServerOptions setWebSocketSubProtocols(List<String> subProtocols) {
|
||||
webSocketSubProtocols = subProtocols;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Get the WebSocket list of sub-protocol
|
||||
*/
|
||||
public List<String> getWebSocketSubProtocols() {
|
||||
return webSocketSubProtocols;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -767,97 +846,215 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
*
|
||||
* @param supported {@code true} when the per-frame deflate compression extension is supported
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setPerFrameWebSocketCompressionSupported}
|
||||
*/
|
||||
public HttpServerOptions setPerFrameWebsocketCompressionSupported(boolean supported ) {
|
||||
this.perFrameWebsocketCompressionSupported = supported;
|
||||
return this;
|
||||
@Deprecated
|
||||
public HttpServerOptions setPerFrameWebsocketCompressionSupported(boolean supported) {
|
||||
this.perFrameWebSocketCompressionSupported = supported;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Enable or disable support for the WebSocket per-frame deflate compression extension.
|
||||
*
|
||||
* @param supported {@code true} when the per-frame deflate compression extension is supported
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpServerOptions setPerFrameWebSocketCompressionSupported(boolean supported) {
|
||||
this.perFrameWebSocketCompressionSupported = supported;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether WebSocket the per-frame deflate compression extension is supported.
|
||||
*
|
||||
* @return {@code true} if the http server will accept the per-frame deflate compression extension
|
||||
* @deprecated instead use {@link #getPerFrameWebSocketCompressionSupported}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getPerFrameWebsocketCompressionSupported() {
|
||||
return this.perFrameWebSocketCompressionSupported;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether WebSocket the per-frame deflate compression extension is supported.
|
||||
*
|
||||
* @return {@code true} if the http server will accept the per-frame deflate compression extension
|
||||
*/
|
||||
public boolean getPerFrameWebsocketCompressionSupported() {
|
||||
return this.perFrameWebsocketCompressionSupported;
|
||||
public boolean getPerFrameWebSocketCompressionSupported() {
|
||||
return this.perFrameWebSocketCompressionSupported;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enable or disable support for WebSocket per-message deflate compression extension.
|
||||
*
|
||||
* @param supported {@code true} when the per-message Websocket compression extension is supported
|
||||
* @param supported {@code true} when the per-message WebSocket compression extension is supported
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setPerMessageWebSocketCompressionSupported}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpServerOptions setPerMessageWebsocketCompressionSupported(boolean supported) {
|
||||
this.perMessageWebSocketCompressionSupported = supported;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable support for WebSocket per-message deflate compression extension.
|
||||
*
|
||||
* @param supported {@code true} when the per-message WebSocket compression extension is supported
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpServerOptions setPerMessageWebsocketCompressionSupported(boolean supported ) {
|
||||
this.perMessageWebsocketCompressionSupported = supported;
|
||||
return this;
|
||||
public HttpServerOptions setPerMessageWebSocketCompressionSupported(boolean supported) {
|
||||
this.perMessageWebSocketCompressionSupported = supported;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get whether WebSocket per-message deflate compression extension is supported.
|
||||
*
|
||||
* @return {@code true} if the http server will accept the per-message deflate compression extension
|
||||
* @deprecated instead use {@link #getPerMessageWebSocketCompressionSupported}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getPerMessageWebsocketCompressionSupported() {
|
||||
return this.perMessageWebSocketCompressionSupported;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether WebSocket per-message deflate compression extension is supported.
|
||||
*
|
||||
* @return {@code true} if the http server will accept the per-message deflate compression extension
|
||||
*/
|
||||
public boolean getPerMessageWebsocketCompressionSupported() {
|
||||
return this.perMessageWebsocketCompressionSupported;
|
||||
public boolean getPerMessageWebSocketCompressionSupported() {
|
||||
return this.perMessageWebSocketCompressionSupported;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the WebSocket compression level.
|
||||
*
|
||||
* @param compressionLevel the compression level
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setWebSocketCompressionLevel}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpServerOptions setWebsocketCompressionLevel(int compressionLevel) {
|
||||
this.webSocketCompressionLevel = compressionLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the WebSocket compression level.
|
||||
*
|
||||
* @param compressionLevel the compression level
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpServerOptions setWebsocketCompressionLevel(int compressionLevel) {
|
||||
this.websocketCompressionLevel = compressionLevel;
|
||||
return this;
|
||||
public HttpServerOptions setWebSocketCompressionLevel(int compressionLevel) {
|
||||
this.webSocketCompressionLevel = compressionLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the current WebSocket deflate compression level
|
||||
* @deprecated instead use {@link #getWebSocketCompressionLevel}
|
||||
*/
|
||||
@Deprecated
|
||||
public int getWebsocketCompressionLevel() {
|
||||
return this.webSocketCompressionLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current WebSocket deflate compression level
|
||||
*/
|
||||
public int getWebsocketCompressionLevel() {
|
||||
return this.websocketCompressionLevel;
|
||||
public int getWebSocketCompressionLevel() {
|
||||
return this.webSocketCompressionLevel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set whether the WebSocket server will accept the {@code server_no_context_takeover} parameter of the per-message
|
||||
* deflate compression extension offered by the client.
|
||||
*
|
||||
* @param accept {@code true} to accept the {@literal server_no_context_takeover} parameter when the client offers it
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setWebSocketAllowServerNoContext}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpServerOptions setWebsocketAllowServerNoContext(boolean accept) {
|
||||
this.websocketAllowServerNoContext = accept;
|
||||
return this;
|
||||
this.webSocketAllowServerNoContext = accept;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set whether the WebSocket server will accept the {@code server_no_context_takeover} parameter of the per-message
|
||||
* deflate compression extension offered by the client.
|
||||
*
|
||||
* @param accept {@code true} to accept the {@literal server_no_context_takeover} parameter when the client offers it
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpServerOptions setWebSocketAllowServerNoContext(boolean accept) {
|
||||
this.webSocketAllowServerNoContext = accept;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the WebSocket server will accept the {@code server_no_context_takeover} parameter for the per-message
|
||||
* deflate compression extension offered by the client
|
||||
* @deprecated instead use {@link #getWebSocketAllowServerNoContext}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getWebsocketAllowServerNoContext() {
|
||||
return this.webSocketAllowServerNoContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the WebSocket server will accept the {@code server_no_context_takeover} parameter for the per-message
|
||||
* deflate compression extension offered by the client
|
||||
*/
|
||||
public boolean getWebsocketAllowServerNoContext () {
|
||||
return this.websocketAllowServerNoContext;
|
||||
public boolean getWebSocketAllowServerNoContext() {
|
||||
return this.webSocketAllowServerNoContext;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set whether the WebSocket server will accept the {@code client_no_context_takeover} parameter of the per-message
|
||||
* deflate compression extension offered by the client.
|
||||
*
|
||||
* @param accept {@code true} to accept the {@code client_no_context_takeover} parameter when the client offers it
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
* @deprecated instead use {@link #setWebSocketPreferredClientNoContext}
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpServerOptions setWebsocketPreferredClientNoContext(boolean accept) {
|
||||
this.websocketPreferredClientNoContext = accept;
|
||||
return this;
|
||||
this.webSocketPreferredClientNoContext = accept;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the WebSocket server will accept the {@code client_no_context_takeover} parameter of the per-message
|
||||
* deflate compression extension offered by the client.
|
||||
*
|
||||
* @param accept {@code true} to accept the {@code client_no_context_takeover} parameter when the client offers it
|
||||
* @return a reference to this, so the API can be used fluently
|
||||
*/
|
||||
public HttpServerOptions setWebSocketPreferredClientNoContext(boolean accept) {
|
||||
this.webSocketPreferredClientNoContext = accept;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the WebSocket server will accept the {@code client_no_context_takeover} parameter for the per-message
|
||||
* deflate compression extension offered by the client
|
||||
* @deprecated instead use {@link #getWebSocketPreferredClientNoContext}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getWebsocketPreferredClientNoContext() {
|
||||
return this.webSocketPreferredClientNoContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} when the WebSocket server will accept the {@code client_no_context_takeover} parameter for the per-message
|
||||
* deflate compression extension offered by the client
|
||||
*/
|
||||
public boolean getWebsocketPreferredClientNoContext() {
|
||||
return this.websocketPreferredClientNoContext;
|
||||
public boolean getWebSocketPreferredClientNoContext() {
|
||||
return this.webSocketPreferredClientNoContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -869,8 +1066,8 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
HttpServerOptions that = (HttpServerOptions) o;
|
||||
|
||||
if (compressionSupported != that.compressionSupported) return false;
|
||||
if (maxWebsocketFrameSize != that.maxWebsocketFrameSize) return false;
|
||||
if (maxWebsocketMessageSize != that.maxWebsocketMessageSize) return false;
|
||||
if (maxWebSocketFrameSize != that.maxWebSocketFrameSize) return false;
|
||||
if (maxWebSocketMessageSize != that.maxWebSocketMessageSize) return false;
|
||||
if (handle100ContinueAutomatically != that.handle100ContinueAutomatically) return false;
|
||||
if (maxChunkSize != that.maxChunkSize) return false;
|
||||
if (maxInitialLineLength != that.maxInitialLineLength) return false;
|
||||
@@ -881,13 +1078,13 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
if (decompressionSupported != that.decompressionSupported) return false;
|
||||
if (acceptUnmaskedFrames != that.acceptUnmaskedFrames) return false;
|
||||
if (decoderInitialBufferSize != that.decoderInitialBufferSize) return false;
|
||||
if (perFrameWebsocketCompressionSupported != that.perFrameWebsocketCompressionSupported) return false;
|
||||
if (perMessageWebsocketCompressionSupported != that.perMessageWebsocketCompressionSupported) return false;
|
||||
if (websocketCompressionLevel != that.websocketCompressionLevel) return false;
|
||||
if (websocketAllowServerNoContext != that.websocketAllowServerNoContext) return false;
|
||||
if (websocketPreferredClientNoContext != that.websocketPreferredClientNoContext) return false;
|
||||
if (perFrameWebSocketCompressionSupported != that.perFrameWebSocketCompressionSupported) return false;
|
||||
if (perMessageWebSocketCompressionSupported != that.perMessageWebSocketCompressionSupported) return false;
|
||||
if (webSocketCompressionLevel != that.webSocketCompressionLevel) return false;
|
||||
if (webSocketAllowServerNoContext != that.webSocketAllowServerNoContext) return false;
|
||||
if (webSocketPreferredClientNoContext != that.webSocketPreferredClientNoContext) return false;
|
||||
|
||||
return !(websocketSubProtocols != null ? !websocketSubProtocols.equals(that.websocketSubProtocols) : that.websocketSubProtocols != null);
|
||||
return !(webSocketSubProtocols != null ? !webSocketSubProtocols.equals(that.webSocketSubProtocols) : that.webSocketSubProtocols != null);
|
||||
|
||||
}
|
||||
|
||||
@@ -895,9 +1092,9 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
result = 31 * result + (compressionSupported ? 1 : 0);
|
||||
result = 31 * result + maxWebsocketFrameSize;
|
||||
result = 31 * result + maxWebsocketMessageSize;
|
||||
result = 31 * result + (websocketSubProtocols != null ? websocketSubProtocols.hashCode() : 0);
|
||||
result = 31 * result + maxWebSocketFrameSize;
|
||||
result = 31 * result + maxWebSocketMessageSize;
|
||||
result = 31 * result + (webSocketSubProtocols != null ? webSocketSubProtocols.hashCode() : 0);
|
||||
result = 31 * result + (initialSettings != null ? initialSettings.hashCode() : 0);
|
||||
result = 31 * result + (handle100ContinueAutomatically ? 1 : 0);
|
||||
result = 31 * result + maxChunkSize;
|
||||
@@ -908,11 +1105,11 @@ public class HttpServerOptions extends NetServerOptions {
|
||||
result = 31 * result + (decompressionSupported ? 1 : 0);
|
||||
result = 31 * result + (acceptUnmaskedFrames ? 1 : 0);
|
||||
result = 31 * result + decoderInitialBufferSize;
|
||||
result = 31 * result + (perFrameWebsocketCompressionSupported ? 1 : 0);
|
||||
result = 31 * result + (perMessageWebsocketCompressionSupported ? 1 : 0);
|
||||
result = 31 * result + websocketCompressionLevel;
|
||||
result = 31 * result + (websocketAllowServerNoContext ? 1 : 0);
|
||||
result = 31 * result + (websocketPreferredClientNoContext ? 1 : 0);
|
||||
result = 31 * result + (perFrameWebSocketCompressionSupported ? 1 : 0);
|
||||
result = 31 * result + (perMessageWebSocketCompressionSupported ? 1 : 0);
|
||||
result = 31 * result + webSocketCompressionLevel;
|
||||
result = 31 * result + (webSocketAllowServerNoContext ? 1 : 0);
|
||||
result = 31 * result + (webSocketPreferredClientNoContext ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import javax.security.cert.X509Certificate;
|
||||
/**
|
||||
* Represents a server side WebSocket.
|
||||
* <p>
|
||||
* Instances of this class are passed into a {@link io.vertx.core.http.HttpServer#websocketHandler} or provided
|
||||
* Instances of this class are passed into a {@link io.vertx.core.http.HttpServer#webSocketHandler} or provided
|
||||
* when a WebSocket handshake is manually {@link HttpServerRequest#upgrade}ed.
|
||||
*
|
||||
* @author <a href="http://tfox.org">Tim Fox</a>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2017 Contributors to the Eclipse Foundation
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
|
||||
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||
*/
|
||||
|
||||
package io.vertx.core.http;
|
||||
|
||||
import io.vertx.core.VertxException;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
|
||||
*/
|
||||
public class UpgradeRejectedException extends VertxException {
|
||||
|
||||
private final int status;
|
||||
|
||||
public UpgradeRejectedException(String message, int status) {
|
||||
super(message);
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the status code of the response that rejected the upgrade
|
||||
*/
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -11,24 +11,14 @@
|
||||
|
||||
package io.vertx.core.http;
|
||||
|
||||
import io.vertx.core.VertxException;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
|
||||
* @deprecated instead use {@code UpgradeRejectedException}
|
||||
*/
|
||||
public class WebsocketRejectedException extends VertxException {
|
||||
|
||||
private final int status;
|
||||
@Deprecated
|
||||
public class WebsocketRejectedException extends UpgradeRejectedException {
|
||||
|
||||
public WebsocketRejectedException(int status) {
|
||||
super("Websocket connection attempt returned HTTP status code " + status);
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the status code of the response that rejected the upgrade
|
||||
*/
|
||||
public int getStatus() {
|
||||
return status;
|
||||
super("Websocket connection attempt returned HTTP status code " + status, status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +104,12 @@ public class HttpServerImpl implements HttpServer, Closeable, MetricsProvider {
|
||||
return requestStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpServer webSocketHandler(Handler<ServerWebSocket> handler) {
|
||||
webSocketStream().handler(handler);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpServer websocketHandler(Handler<ServerWebSocket> handler) {
|
||||
websocketStream().handler(handler);
|
||||
@@ -138,11 +144,21 @@ public class HttpServerImpl implements HttpServer, Closeable, MetricsProvider {
|
||||
return wsStream.handler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Handler<ServerWebSocket> webSocketHandler() {
|
||||
return wsStream.handler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReadStream<ServerWebSocket> websocketStream() {
|
||||
return wsStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReadStream<ServerWebSocket> webSocketStream() {
|
||||
return wsStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpServer listen() {
|
||||
return listen(options.getPort(), options.getHost(), null);
|
||||
|
||||
@@ -85,7 +85,10 @@ class WebSocketHandshakeInboundHandler extends ChannelInboundHandlerAdapter {
|
||||
|
||||
private Future<HeadersAdaptor> handshakeComplete(FullHttpResponse response) {
|
||||
if (response.status().code() != 101) {
|
||||
return Future.failedFuture(new WebsocketRejectedException(response.status().code()));
|
||||
// Use UpgradeRejectedException in v4 instead
|
||||
@SuppressWarnings("deprecation")
|
||||
WebsocketRejectedException failure = new WebsocketRejectedException(response.status().code());
|
||||
return Future.failedFuture(failure);
|
||||
} else {
|
||||
try {
|
||||
handshaker.finishHandshake(chctx.channel(), response);
|
||||
|
||||
@@ -366,7 +366,7 @@ public class Http1xTest extends HttpTest {
|
||||
assertEquals("foo", options.getWebsocketSubProtocols());
|
||||
|
||||
HttpServerOptions optionsCopy = new HttpServerOptions(options);
|
||||
assertEquals(options, optionsCopy.setWebsocketSubProtocols(new String(options.getWebsocketSubProtocols())));
|
||||
assertEquals(options, optionsCopy.setWebsocketSubProtocols(options.getWebsocketSubProtocols()));
|
||||
|
||||
assertTrue(options.getEnabledCipherSuites().isEmpty());
|
||||
assertEquals(options, options.addEnabledCipherSuite("foo"));
|
||||
|
||||
Reference in New Issue
Block a user