All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.kotlin.core.http.WebSocketConnectOptions.kt Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR1
Show newest version
/*
 * Copyright 2019 Red Hat, Inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Apache License v2.0 which accompanies this distribution.
 *
 * The Eclipse Public License is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * The Apache License v2.0 is available at
 * http://www.opensource.org/licenses/apache2.0.php
 *
 * You may elect to redistribute this code under either of these licenses.
 */
package io.vertx.kotlin.core.http

import io.vertx.core.http.WebSocketConnectOptions
import io.vertx.core.http.WebsocketVersion
import io.vertx.core.net.ProxyOptions

/**
 * A function providing a DSL for building [io.vertx.core.http.WebSocketConnectOptions] objects.
 *
 * Options describing how an [io.vertx.core.http.HttpClient] connect a [io.vertx.core.http.WebSocket].
 *
 * @param absoluteURI  Parse an absolute URI to use, this will update the ssl, host, port and uri fields.
 * @param allowOriginHeader  Set whether to add the origin header to the WebSocket handshake request, enabled by default. 

Set to false when a server does not accept WebSocket with an origin header. * @param followRedirects Set whether to follow HTTP redirect * @param headers Add a request header. * @param host Set the host name to be used by the client request. * @param port Set the port to be used by the client request. * @param proxyOptions Override the [io.vertx.core.http.HttpClientOptions] proxy options for connections. * @param registerWriteHandlers Whether write-handlers should be registered on the [io.vertx.core.eventbus.EventBus].

Defaults to false. * @param server Set the server address to be used by the client request.

When the server address is null, the address will be resolved after the host property by the Vert.x resolver.

Use this when you want to connect to a specific server address without name resolution. * @param ssl Set whether SSL/TLS is enabled. * @param subProtocols Set the WebSocket sub protocols to use. * @param timeout Sets the amount of time after which if the WebSocket handshake does not happen within the timeout period an will be passed to the exception handler and the connection will be closed. * @param traceOperation Override the operation the tracer use for this request. When no operation is set, the HTTP method is used instead. * @param uri Set the request relative URI. * @param version Set the WebSocket version. * *

* NOTE: This function has been automatically generated from the [io.vertx.core.http.WebSocketConnectOptions original] using Vert.x codegen. */ fun webSocketConnectOptionsOf( absoluteURI: String? = null, allowOriginHeader: Boolean? = null, followRedirects: Boolean? = null, headers: Map? = null, host: String? = null, port: Int? = null, proxyOptions: io.vertx.core.net.ProxyOptions? = null, registerWriteHandlers: Boolean? = null, server: io.vertx.core.net.SocketAddress? = null, ssl: Boolean? = null, subProtocols: Iterable? = null, timeout: Long? = null, traceOperation: String? = null, uri: String? = null, version: WebsocketVersion? = null): WebSocketConnectOptions = io.vertx.core.http.WebSocketConnectOptions().apply { if (absoluteURI != null) { this.setAbsoluteURI(absoluteURI) } if (allowOriginHeader != null) { this.setAllowOriginHeader(allowOriginHeader) } if (followRedirects != null) { this.setFollowRedirects(followRedirects) } if (headers != null) { for (item in headers) { this.addHeader(item.key, item.value) } } if (host != null) { this.setHost(host) } if (port != null) { this.setPort(port) } if (proxyOptions != null) { this.setProxyOptions(proxyOptions) } if (registerWriteHandlers != null) { this.setRegisterWriteHandlers(registerWriteHandlers) } if (server != null) { this.setServer(server) } if (ssl != null) { this.setSsl(ssl) } if (subProtocols != null) { this.setSubProtocols(subProtocols.toList()) } if (timeout != null) { this.setTimeout(timeout) } if (traceOperation != null) { this.setTraceOperation(traceOperation) } if (uri != null) { this.setURI(uri) } if (version != null) { this.setVersion(version) } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy