public class Connection extends EventEmitter<ConnectionEvent,ConnectionStateListener>
EventEmitter.Filter| Modifier and Type | Field and Description |
|---|---|
ConnectionManager |
connectionManager |
java.lang.String |
id
A public identifier for this connection, used to identify
this member in presence events and message ids.
|
java.lang.String |
key
The assigned connection key.
|
ErrorInfo |
reason
Error information associated with a connection failure.
|
java.lang.String |
recoveryKey
RTN16b) Connection#recoveryKey is an attribute composed of the connection key and latest
serial received on the connection
|
long |
serial
The serial number of the last message to be received on this connection.
|
ConnectionState |
state
The current state of this Connection.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
apply(ConnectionStateListener listener,
ConnectionEvent event,
java.lang.Object... args) |
void |
close()
Causes the connection to close, entering the closed state, from any state except
the failed state.
|
void |
connect()
Causes the library to re-attempt connection, if it was previously explicitly
closed by the user, or was closed as a result of an unrecoverable error.
|
void |
emit(ConnectionState state,
ConnectionStateListener.ConnectionStateChange stateChange)
Deprecated.
|
void |
emitUpdate(ErrorInfo errorInfo) |
void |
on(ConnectionState state,
ConnectionStateListener listener)
Deprecated.
|
void |
once(ConnectionState state,
ConnectionStateListener listener)
Deprecated.
|
void |
onConnectionStateChange(ConnectionStateListener.ConnectionStateChange stateChange) |
void |
ping(CompletionListener listener)
Send a heartbeat message to the Ably service and await a response.
|
public ConnectionState state
public ErrorInfo reason
public java.lang.String key
public java.lang.String recoveryKey
public java.lang.String id
public long serial
public final ConnectionManager connectionManager
public void connect()
public void ping(CompletionListener listener)
listener: - a listener to be notified of the outcome of this message.public void close()
connect().public void onConnectionStateChange(ConnectionStateListener.ConnectionStateChange stateChange)
protected void apply(ConnectionStateListener listener, ConnectionEvent event, java.lang.Object... args)
apply in class EventEmitter<ConnectionEvent,ConnectionStateListener>public void emitUpdate(ErrorInfo errorInfo)
@Deprecated public void emit(ConnectionState state, ConnectionStateListener.ConnectionStateChange stateChange)
@Deprecated public void on(ConnectionState state, ConnectionStateListener listener)
@Deprecated public void once(ConnectionState state, ConnectionStateListener listener)