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 SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>closeFuture()Returns a future which is complete, when the connection is closed.longdetach()Detaches this BOSH session without closing (aka terminating) it.voidflush()Flushes the connection.InetSocketAddressgetRemoteAddress()Gets the remote address of this connection.StringgetRoute()Gets the route.StringgetSessionId()Gets the session id of this BOSH connection.booleanisSecure()Indicates whether this connection is secured by TLS/SSL.booleanisUsingAcknowledgements()Indicates whether this connection uses acknowledgements, e.g. by means of stream management or BOSH acks.CompletionStage<Void>open(SessionOpen sessionOpen)Opens the XML stream to the peer entity.CompletableFuture<Void>send(StreamElement element)Sends an element to the peer entity.CompletableFuture<Void>write(StreamElement streamElement)Writes the element to the stream without really sending it.- 
Methods inherited from class rocks.xmpp.core.net.AbstractConnectionclose, closeAsync, closeAsync, getConfiguration, getStreamId, handleElement, isClosed
 
- 
 
- 
- 
- 
Method Detail- 
openpublic final CompletionStage<Void> open(SessionOpen sessionOpen) Description copied from interface:ConnectionOpens the XML stream to the peer entity.- Parameters:
- sessionOpen- The session open information.
- Returns:
- The completion stage, which is complete, if the session has been opened, i.e. the element has been sent.
 
 - 
isSecurepublic final boolean isSecure() Description copied from interface:ConnectionIndicates whether this connection is secured by TLS/SSL.- Returns:
- True, if this connection is secured.
 
 - 
closeFuturepublic final CompletionStage<Void> closeFuture() Description copied from interface:ConnectionReturns a future which is complete, when the connection is closed.- Returns:
- The close future.
 
 - 
detachpublic 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
 
 - 
sendpublic final CompletableFuture<Void> send(StreamElement element) Description copied from interface:Connection- Parameters:
- element- The element.
- Returns:
- The future representing the send process and which allows to cancel it.
 
 - 
writepublic final CompletableFuture<Void> write(StreamElement streamElement) Description copied from interface:ConnectionWrites the element to the stream without really sending it. It must be flushed.- Parameters:
- streamElement- The element.
- Returns:
- The send future.
 
 - 
flushpublic final void flush() Description copied from interface:ConnectionFlushes the connection. Any buffered elements written viaConnection.write(StreamElement)are sent.
 - 
getSessionIdpublic final String getSessionId() Gets the session id of this BOSH connection.- Returns:
- The session id.
 
 - 
getRemoteAddresspublic final InetSocketAddress getRemoteAddress() Description copied from interface:ConnectionGets the remote address of this connection.- Returns:
- The remote address.
 
 - 
isUsingAcknowledgementspublic final boolean isUsingAcknowledgements() Description copied from interface:ConnectionIndicates whether this connection uses acknowledgements, e.g. by means of stream management or BOSH acks.- Specified by:
- isUsingAcknowledgementsin interface- Connection
- Overrides:
- isUsingAcknowledgementsin class- AbstractConnection
- Returns:
- If this connection uses acknowledgements.
 
 - 
getRoutepublic 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.
 
 
- 
 
-