public final class BoshConnection extends Connection
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the session as described in Terminating the HTTP Session.
|
void |
connect(rocks.xmpp.addr.Jid from,
String namespace,
Consumer<rocks.xmpp.addr.Jid> onStreamOpened)
Connects to the BOSH server.
|
long |
detach()
Detaches this BOSH session without closing (aka terminating) it.
|
String |
getRoute()
Gets the route.
|
String |
getSessionId()
Gets the session id of this BOSH connection.
|
String |
getStreamId()
Gets the stream id of this connection.
|
boolean |
isSecure()
Indicates whether this connection is secured by TLS/SSL.
|
boolean |
isUsingAcknowledgements()
Indicates, whether this connection is using acknowledgements.
|
CompletableFuture<Void> |
send(StreamElement element)
Sends an element over this connection.
|
String |
toString() |
getHostname, getPort, getProxypublic final void connect(rocks.xmpp.addr.Jid from,
String namespace,
Consumer<rocks.xmpp.addr.Jid> onStreamOpened)
throws IOException
connect in class Connectionfrom - The optional 'from' attribute in the initial BOSH session creation request.namespace - The content namespace, e.g. "jabber:client".onStreamOpened - The callback which gets notified when the stream gets opened, i.e. when the server has responded with a stream header. The parameter of the consumer is the stream id.IOException - If a connection could not be established.public final boolean isSecure()
ConnectionisSecure in class Connectionpublic final void close()
This method can be called from different threads:
public final long detach()
public final CompletableFuture<Void> send(StreamElement element)
Connectionsend in class Connectionelement - The element.public final String getSessionId()
public final String getStreamId()
ConnectiongetStreamId in class Connectionpublic final boolean isUsingAcknowledgements()
ConnectionTCP and WebSocket connections use XEP-0198: Stream Management to acknowledge stanzas.
BOSH connections use another mechanism for acknowledgements, described in XEP-0124 § 9. Acknowledgements.
isUsingAcknowledgements in class Connectionpublic final String getRoute()
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").
Copyright © 2014–2016 XMPP.rocks. All rights reserved.