public final class WebSocketConnectionConfiguration extends ClientConnectionConfiguration
A configuration for a WebSocket connection. It allows you to configure basic connection settings like hostname and port, as well as the path in the WebSocket URI.
WebSocketConnectionConfiguration connectionConfiguration = WebSocketConnectionConfiguration.builder()
.hostname("localhost")
.port(7443)
.path("/ws/")
.sslContext(sslContext)
.channelEncryption(ChannelEncryption.DIRECT)
.build();
The above sample configuration will connect to wss://localhost:7443/ws/
using SSL with a custom SSLContext
.
This class is immutable.
WebSocketConnection
,
XMPP Subprotocol for WebSocketModifier and Type | Class and Description |
---|---|
static class |
WebSocketConnectionConfiguration.Builder
A builder to create a
WebSocketConnectionConfiguration instance. |
Modifier and Type | Method and Description |
---|---|
static WebSocketConnectionConfiguration.Builder |
builder()
Creates a new builder.
|
Connection |
createConnection(XmppSession xmppSession)
A factory method to create the connection.
|
static WebSocketConnectionConfiguration |
getDefault()
Gets the default configuration.
|
java.lang.String |
getPath()
Gets the path on the host, e.g.
|
java.time.Duration |
getPingInterval()
Gets the ping interval.
|
static void |
setDefault(WebSocketConnectionConfiguration configuration)
Sets the default configuration.
|
java.lang.String |
toString() |
getChannelEncryption, getCompressionMethods, getConnectTimeout, getHostname, getHostnameVerifier, getPort, getProxy, getSSLContext
public static WebSocketConnectionConfiguration getDefault()
Gets the default configuration.
public static void setDefault(WebSocketConnectionConfiguration configuration)
Sets the default configuration.
configuration
- The default configuration.public static WebSocketConnectionConfiguration.Builder builder()
Creates a new builder.
public final java.lang.String getPath()
Gets the path on the host, e.g. “/ws/”.
public final java.time.Duration getPingInterval()
Gets the ping interval.
WebSocketConnectionConfiguration.Builder.pingInterval(Duration)
public final Connection createConnection(XmppSession xmppSession) throws java.lang.Exception
ClientConnectionConfiguration
A factory method to create the connection.
createConnection
in class ClientConnectionConfiguration
xmppSession
- The XMPP session, which is associated with the connection.java.lang.Exception
- Any exception which may occur during connection establishment.public final java.lang.String toString()
toString
in class ClientConnectionConfiguration
Copyright © 2014–2019 XMPP.rocks. All rights reserved.