Package rocks.xmpp.core
Interface Session
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
ExternalComponent,XmppClient,XmppSession
public interface Session extends AutoCloseable
A generic interface for different kinds of XMPP sessions.- A client-to-server session
- An external component session (XEP-0114: Jabber Component Protocol).
- A client-to-client session (XEP-0174: Serverless Messaging)
- A server-to-server session
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()CompletionStage<Void>closeAsync()Asynchronously closes the session.CompletionStage<Void>closeAsync(StreamError streamError)Asynchronously closes the session with a stream error.JidgetLocalXmppAddress()Gets the local XMPP address.JidgetRemoteXmppAddress()Gets the remote XMPP address.CompletionStage<Void>send(StreamElement streamElement)Sends an element to the peer entity.
-
-
-
Method Detail
-
getLocalXmppAddress
Jid getLocalXmppAddress()
Gets the local XMPP address. This method may return null, e.g. for client-to-server sessions before resource binding.- Returns:
- The local XMPP address or null.
-
getRemoteXmppAddress
Jid getRemoteXmppAddress()
Gets the remote XMPP address. This method may return null, if the session is not fully negotiated.- Returns:
- The remote XMPP address or null.
-
send
CompletionStage<Void> send(StreamElement streamElement)
Sends an element to the peer entity.- Parameters:
streamElement- The element.- Returns:
- The completion stage, which is complete when the element has been sent.
-
closeAsync
CompletionStage<Void> closeAsync()
Asynchronously closes the session.Closing usually involves a round-trip with the peer on the XMPP layer first by sending a closing stream element, then waiting on the response and then closing the underlying transport layer.
- Returns:
- The completion stage, which is complete, when the session is closed.
- See Also:
close(),Connection.closeAsync()
-
closeAsync
CompletionStage<Void> closeAsync(StreamError streamError)
Asynchronously closes the session with a stream error.- Parameters:
streamError- The stream error, which is sent before closing the stream.- Returns:
- The completion stage, which is complete, when the session is closed.
- See Also:
closeAsync(),Connection.closeAsync(StreamError)
-
close
void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
-