Package org.signal.libsignal.net
Class ChatConnection
-
- All Implemented Interfaces:
-
org.signal.libsignal.internal.NativeHandleGuard.Owner
public abstract class ChatConnection extends NativeHandleGuard.SimpleOwner
Represents an established connection to the Chat Service.
When a new
ChatConnectionis created, it is connected but not yet active. The registered listener will not receive any events until start is called.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classChatConnection.Requestpublic final classChatConnection.Response
-
Method Summary
Modifier and Type Method Description voidstart()Starts a created, but not yet active, chat connection. CompletableFuture<Void>disconnect()Initiates termination of the underlying connection to the Chat Service. CompletableFuture<ChatConnection.Response>send(ChatConnection.Request req)Sends request to the Chat Service over this channel. -
Methods inherited from class org.signal.libsignal.internal.NativeHandleGuard.SimpleOwner
unsafeNativeHandleWithoutGuard -
Methods inherited from class org.signal.libsignal.internal.NativeHandleGuard.Owner
guard, guardedMap, guardedMapChecked, guardedRun, guardedRunChecked -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
start
void start()
Starts a created, but not yet active, chat connection.
This must be called on a new
ChatConnectionbefore it can start receiving incoming messages from the server. It is an error to call this method more than once on aChatConnection.
-
disconnect
CompletableFuture<Void> disconnect()
Initiates termination of the underlying connection to the Chat Service. After the service is disconnected, it cannot be reconnected.
- Returns:
a future that completes when the underlying connection is terminated.
-
send
CompletableFuture<ChatConnection.Response> send(ChatConnection.Request req)
Sends request to the Chat Service over this channel.
- Parameters:
req- request object- Returns:
a
CompletableFutureof a Response.
-
-
-
-