Package rocks.xmpp.extensions.httpbind
Class BoshConnection
- java.lang.Object
-
- rocks.xmpp.core.net.AbstractConnection
-
- rocks.xmpp.extensions.httpbind.BoshConnection
-
- All Implemented Interfaces:
AutoCloseable,Connection,StreamHandler
public abstract class BoshConnection extends AbstractConnection
The abstract base class for BOSH connections.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>closeFuture()longdetach()Detaches this BOSH session without closing (aka terminating) it.voidflush()InetSocketAddressgetRemoteAddress()StringgetRoute()Gets the route.StringgetSessionId()Gets the session id of this BOSH connection.booleanisSecure()booleanisUsingAcknowledgements()CompletionStage<Void>open(SessionOpen sessionOpen)CompletableFuture<Void>send(StreamElement element)CompletableFuture<Void>write(StreamElement streamElement)-
Methods inherited from class rocks.xmpp.core.net.AbstractConnection
close, closeAsync, closeAsync, getConfiguration, getStreamId, handleElement, isClosed
-
-
-
-
Method Detail
-
open
public final CompletionStage<Void> open(SessionOpen sessionOpen)
-
isSecure
public final boolean isSecure()
-
closeFuture
public final CompletionStage<Void> closeFuture()
-
detach
public final long detach()
Detaches this BOSH session without closing (aka terminating) it. This way the BOSH session is still alive on the server and can be ported over to a web page, but new BOSH requests are no longer sent by this connection.- Returns:
- The current request ID (RID) which was used for the last BOSH request.
- See Also:
- https://conversejs.org/docs/html/#prebinding-and-single-session-support
-
send
public final CompletableFuture<Void> send(StreamElement element)
-
write
public final CompletableFuture<Void> write(StreamElement streamElement)
-
flush
public final void flush()
-
getSessionId
public final String getSessionId()
Gets the session id of this BOSH connection.- Returns:
- The session id.
-
getRemoteAddress
public final InetSocketAddress getRemoteAddress()
-
isUsingAcknowledgements
public final boolean isUsingAcknowledgements()
- Specified by:
isUsingAcknowledgementsin interfaceConnection- Overrides:
isUsingAcknowledgementsin classAbstractConnection
-
getRoute
public final String getRoute()
Gets the route.A connection manager MAY be configured to enable sessions with more than one server in different domains. When requesting a session with such a "proxy" connection manager, a client SHOULD include a 'route' attribute that specifies the protocol, hostname, and port of the server with which it wants to communicate, formatted as "proto:host:port" (e.g., "xmpp:example.com:9999").
- Returns:
- The route.
-
-