public class WebSocketConnection extends AbstractConnection
An XMPP WebSocket connection.
Constructor and Description |
---|
WebSocketConnection(javax.websocket.Session session,
StreamHandler streamHandler,
java.util.function.Consumer<java.lang.Throwable> onException,
java.util.concurrent.CompletableFuture<java.lang.Void> closeFuture,
ConnectionConfiguration connectionConfiguration) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletionStage<java.lang.Void> |
closeFuture()
Returns a future which is complete, when the connection is closed.
|
void |
flush()
Flushes the connection.
|
java.net.InetSocketAddress |
getRemoteAddress()
Gets the remote address of this connection.
|
boolean |
isSecure()
Indicates whether this connection is secured by TLS/SSL.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
open(SessionOpen sessionOpen)
Opens the XML stream to the peer entity.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
send(StreamElement streamElement)
Sends an element to the peer entity.
|
java.lang.String |
toString() |
java.util.concurrent.CompletableFuture<java.lang.Void> |
write(StreamElement streamElement)
Writes the element to the stream without really sending it.
|
close, closeAsync, closeAsync, getConfiguration, getStreamId, isUsingAcknowledgements
public WebSocketConnection(javax.websocket.Session session, StreamHandler streamHandler, java.util.function.Consumer<java.lang.Throwable> onException, java.util.concurrent.CompletableFuture<java.lang.Void> closeFuture, ConnectionConfiguration connectionConfiguration)
public final java.util.concurrent.CompletionStage<java.lang.Void> closeFuture()
Connection
Returns a future which is complete, when the connection is closed.
public java.util.concurrent.CompletableFuture<java.lang.Void> send(StreamElement streamElement)
Connection
streamElement
- The element.public final java.util.concurrent.CompletableFuture<java.lang.Void> write(StreamElement streamElement)
Connection
Writes the element to the stream without really sending it. It must be flushed.
streamElement
- The element.public final void flush()
Connection
Flushes the connection. Any buffered elements written via Connection.write(StreamElement)
are sent.
public final java.net.InetSocketAddress getRemoteAddress()
Connection
Gets the remote address of this connection.
public final java.util.concurrent.CompletionStage<java.lang.Void> open(SessionOpen sessionOpen)
Connection
Opens the XML stream to the peer entity.
sessionOpen
- The session open information.public final boolean isSecure()
Connection
Indicates whether this connection is secured by TLS/SSL.
public final java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014–2019 XMPP.rocks. All rights reserved.