Java Code Examples for io.vertx.core.http.HttpServerOptions#setWebsocketSubProtocols()
The following examples show how to use
io.vertx.core.http.HttpServerOptions#setWebsocketSubProtocols() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VertxHttpRecorder.java From quarkus with Apache License 2.0 | 6 votes |
private static HttpServerOptions createHttpServerOptions(HttpConfiguration httpConfiguration, LaunchMode launchMode, String websocketSubProtocols) { if (!httpConfiguration.hostEnabled) { return null; } // TODO other config properties HttpServerOptions options = new HttpServerOptions(); options.setHost(httpConfiguration.host); options.setPort(httpConfiguration.determinePort(launchMode)); setIdleTimeout(httpConfiguration, options); options.setMaxHeaderSize(httpConfiguration.limits.maxHeaderSize.asBigInteger().intValueExact()); Optional<MemorySize> maxChunkSize = httpConfiguration.limits.maxChunkSize; if (maxChunkSize.isPresent()) { options.setMaxChunkSize(maxChunkSize.get().asBigInteger().intValueExact()); } options.setWebsocketSubProtocols(websocketSubProtocols); options.setReusePort(httpConfiguration.soReusePort); options.setTcpQuickAck(httpConfiguration.tcpQuickAck); options.setTcpCork(httpConfiguration.tcpCork); options.setTcpFastOpen(httpConfiguration.tcpFastOpen); return options; }
Example 2
Source File: VertxHttpRecorder.java From quarkus with Apache License 2.0 | 6 votes |
private static HttpServerOptions createDomainSocketOptions(HttpConfiguration httpConfiguration, String websocketSubProtocols) { if (!httpConfiguration.domainSocketEnabled) { return null; } HttpServerOptions options = new HttpServerOptions(); options.setHost(httpConfiguration.domainSocket); setIdleTimeout(httpConfiguration, options); options.setMaxHeaderSize(httpConfiguration.limits.maxHeaderSize.asBigInteger().intValueExact()); Optional<MemorySize> maxChunkSize = httpConfiguration.limits.maxChunkSize; if (maxChunkSize.isPresent()) { options.setMaxChunkSize(maxChunkSize.get().asBigInteger().intValueExact()); } options.setWebsocketSubProtocols(websocketSubProtocols); return options; }
Example 3
Source File: Server.java From wisdom with Apache License 2.0 | 4 votes |
private void bind(int p, Handler<AsyncResult<Void>> completion) { // Get port number. final int thePort = pickAPort(port); HttpServerOptions options = new HttpServerOptions(); if (ssl) { options.setSsl(true); options.setTrustStoreOptions(SSLServerContext.getTrustStoreOption(accessor)); options.setKeyStoreOptions(SSLServerContext.getKeyStoreOption(accessor)); if (authentication) { options.setClientAuth(ClientAuth.REQUIRED); } } if (hasCompressionEnabled()) { options.setCompressionSupported(true); } if (configuration.getIntegerWithDefault("vertx.acceptBacklog", -1) != -1) { options.setAcceptBacklog(configuration.getInteger("vertx.acceptBacklog")); } if (configuration.getIntegerWithDefault("vertx.maxWebSocketFrameSize", -1) != -1) { options.setMaxWebsocketFrameSize(configuration.getInteger("vertx.maxWebSocketFrameSize")); } if (configuration.getStringArray("wisdom.websocket.subprotocols").length > 0) { options.setWebsocketSubProtocols(configuration.get("wisdom.websocket.subprotocols")); } if (configuration.getStringArray("vertx.websocket-subprotocols").length > 0) { options.setWebsocketSubProtocols(configuration.get("vertx.websocket-subprotocols")); } if (configuration.getIntegerWithDefault("vertx.receiveBufferSize", -1) != -1) { options.setReceiveBufferSize(configuration.getInteger("vertx.receiveBufferSize")); } if (configuration.getIntegerWithDefault("vertx.sendBufferSize", -1) != -1) { options.setSendBufferSize(configuration.getInteger("vertx.sendBufferSize")); } http = vertx.createHttpServer(options) .requestHandler(new HttpHandler(vertx, accessor, this)) .websocketHandler(new WebSocketHandler(accessor, this)); http.listen(thePort, host, event -> { if (event.succeeded()) { logger.info("Wisdom is going to serve HTTP requests on port {}.", thePort); port = thePort; completion.handle(Future.succeededFuture()); } else if (port == 0) { logger.debug("Cannot bind on port {} (port already used probably)", thePort, event.cause()); bind(0, completion); } else { logger.error("Cannot bind on port {} (port already used probably)", thePort, event.cause()); completion.handle(Future.failedFuture("Cannot bind on port " + thePort)); } }); }