public interface TransportListener extends EventListener
Abstracts the communication between BayeuxClient
and ClientTransport
.
A TransportListener
is associated to every batch of messages being sent,
and notified when responses for those messages come back, or a failure occurs.
MessageClientTransport
Modifier and Type | Interface and Description |
---|---|
static class |
TransportListener.Empty
Deprecated.
use
TransportListener directly instead. |
Modifier and Type | Method and Description |
---|---|
default void |
onFailure(Throwable failure,
List<? extends Message> messages)
Callback method invoked when a failure to send or receive messages occurs.
|
default void |
onMessages(List<Message.Mutable> messages)
Callback method invoked when a batch of message is received.
|
default void |
onSending(List<? extends Message> messages)
Callback method invoked when the batch of messages is being sent.
|
default void |
onTimeout(List<? extends Message> messages,
Promise<Long> promise)
Callback method invoked when the send of a batch of messages expires
before receiving a response from the server, controlled by the
maxNetworkDelay option. |
default void onSending(List<? extends Message> messages)
messages
- the batch of messages being sentdefault void onMessages(List<Message.Mutable> messages)
messages
- the batch of messages receiveddefault void onFailure(Throwable failure, List<? extends Message> messages)
failure
- the failure occurredmessages
- the batch of messages being sentdefault void onTimeout(List<? extends Message> messages, Promise<Long> promise)
Callback method invoked when the send of a batch of messages expires
before receiving a response from the server, controlled by the
maxNetworkDelay
option.
Implementations may extend the wait by succeeding the promise with the number of milliseconds of the extended wait.
Succeeding the callback with 0
or a negative value confirms the
expiration, which will eventually call onFailure(Throwable, List)
with a TimeoutException
.
messages
- the batch of messages sentpromise
- the promise to completeCopyright © 2008–2024 The CometD Project. All rights reserved.