Class HttpClientWebSocketConnector

  • All Implemented Interfaces:
    TransportConnector<WebSocketConnectionConfiguration>

    public final class HttpClientWebSocketConnector
    extends Object
    A WebSocket transport connector which uses WebSocket.

    This is the default connector for WebSocket based XMPP connections if none is defined.

    However, you could still explicitly set it as shown below.

    Sample Usage

    
     WebSocketConnectionConfiguration webSocketConfiguration = WebSocketConnectionConfiguration.builder()
         .hostname("localhost")
         .port(443)
         .sslContext(sslContext)
         .channelEncryption(ChannelEncryption.DIRECT)
         .connector(new HttpClientWebSocketConnector())
         .build();
     

    Hostname Verification

    Please note that the WebSocket API does not allow to set a hostname verifier. To disable hostname verification you have to set the system property:

    -Djdk.internal.httpclient.disableHostnameVerification
    See Also:
    ClientConnectionConfiguration.Builder.connector(TransportConnector)