public abstract class ClientConnectionHandler extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
protected ClientConnection |
clientConnection |
Constructor and Description |
---|
ClientConnectionHandler() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
CompletableFuture<Integer> |
getConnectionClosedFuture() |
protected void |
onConnectionClosed(int closeReason)
Invoked upon the connection closed event.
|
protected abstract void |
onConnectionSetup(ClientConnection connection,
int errorCode)
Invoked upon completion of the Connection attempt
|
protected abstract void |
onProtocolMessage(List<Header> headers,
byte[] payload,
MessageType messageType,
int messageFlags)
Invoked when a message is received on a connection.
|
protected ClientConnection clientConnection
protected abstract void onConnectionSetup(ClientConnection connection, int errorCode)
connection
- if the setup was successful, connection is non-null. On error, errorCode
will be non-zeroerrorCode
- Error representing any error that occurred during connect.protected abstract void onProtocolMessage(List<Header> headers, byte[] payload, MessageType messageType, int messageFlags)
headers
- List of EventStream headers for the message received.payload
- Payload for the message receivedmessageType
- message type for the messagemessageFlags
- message flags for the messagepublic CompletableFuture<Integer> getConnectionClosedFuture()
protected void onConnectionClosed(int closeReason)
closeReason
- The reason the connection was closed. 0 means a clean shutdown.public void close()
close
in interface AutoCloseable
Copyright © 2021. All rights reserved.