public interface ClientListener extends ServerEventListener, ClientPingResponseListener
A Client event is a notification of something that has occurred relating to a client.
Such a listener may be added using
Publishers.addEventListener(ServerEventListener)
.
A default implementation is provided (DefaultClientListener
) which
simplifies use by providing an empty implementation of each method.
Modifier and Type | Field and Description |
---|---|
static int |
CLOSED
Client closed notification mask setting
|
static int |
CONNECTED
Client connected notification mask setting
|
static int |
FETCH_INVALID
Client fetch invalid notification mask setting
|
static int |
NEW_CREDENTIALS
Client new credentials mask setting
|
static int |
PING_RESPONSE
Client ping response notification mask setting
|
static int |
QUEUE_THRESHOLD_REACHED
Client queue threshold reached notification mask setting
|
static int |
RESOLVED
Client resolved notification mask setting
|
static int |
SEND_INVALID
Client send invalid notification mask setting
|
static int |
SUBSCRIPTION_INVALID
Client subscription invalid notification mask setting
|
Modifier and Type | Method and Description |
---|---|
void |
clientClosed(Client client)
This is called when a client connection is closed.
|
void |
clientConnected(Client client)
This is called when a new client is connected.
|
void |
clientCredentials(Client client,
Credentials credentials)
Notifies that a Client has sent new credentials.
|
void |
clientFetchInvalid(Client client,
String topicName,
List<String> headers)
This is called when a client attempts to fetch a topic that does not
exist.
|
void |
clientQueueThresholdReached(Client client,
boolean upper,
int threshold)
Notifies an outbound message queue threshold has been reached.
|
void |
clientResolved(Client client)
This is called when a client's Internet address details have been
resolved.
|
void |
clientSendInvalid(Client client,
TopicMessage message)
This is called when a client attempts to send a message to a topic that
doesn't exist, or to which it is not currently subscribed.
|
void |
clientSubscriptionInvalid(Client client,
String topicName)
This is called when a client attempts to subscribe to a topic that does
not exist.
|
clientPingResponse
static final int CLOSED
static final int CONNECTED
static final int QUEUE_THRESHOLD_REACHED
static final int RESOLVED
static final int SUBSCRIPTION_INVALID
static final int PING_RESPONSE
static final int FETCH_INVALID
static final int NEW_CREDENTIALS
static final int SEND_INVALID
void clientConnected(Client client)
This is a synchronous notification and so this method should return as promptly as possible to avoid blocking an inbound thread. Any significant processing should be delegated to another thread.
client
- the client that has connected.void clientClosed(Client client)
client
- the client that closed.void clientSubscriptionInvalid(Client client, String topicName)
This only occurs when a topic name is specified that does not exist and not if a topic selector is specified which matches no current topics.
client
- the client.topicName
- the name of the topic that the client has attempted to
subscribe to.void clientFetchInvalid(Client client, String topicName, List<String> headers)
This only occurs when a topic name is specified that does not exist and not if a topic selector is specified which matches no current topics.
This allows for the implementation of a request/response mechanism
without the need for Topics as a reply can then be sent using the
TopicClient.sendFetchReply(TopicMessage, List)
method.
client
- the client.topicName
- the name of the topic that the client has attempted to
fetch.headers
- any headers passed with the request. These may be sent
back as additional headers with the reply.void clientSendInvalid(Client client, TopicMessage message)
client
- the client that sent the messagemessage
- the message that was sent by the clientvoid clientResolved(Client client)
The client is resolved using the WhoIs service and then notified.
Client.getWhoIsDetails()
can be used to obtain the fully resolved
details of the client.
client
- the client that has been resolved.void clientQueueThresholdReached(Client client, boolean upper, int threshold)
This will only be called if message queue thresholds have been declared.
See Client.setQueueNotificationThresholds(int, int)
for details
of the meanings of the thresholds.
client
- the client connection.upper
- true to notify upper threshold reached, false to notify
lower threshold reached.threshold
- the threshold value.void clientCredentials(Client client, Credentials credentials)
The Client may supply credentials on connection or may supply after connection, any number of times. This notifications is caused whenever a Client sends credentials after connection.
This will be notified only after any
authorisation handler
has been called and credentials validated.
This is a synchronous notification and so this method should return as promptly as possible to avoid blocking an inbound thread. Any significant processing should be delegated to another thread.
client
- the client connection.credentials
- the new credentials (as supplied). When there is no
authorisation handler then this would be the same as the
credentials now set on the client, however when there is an
authorisation handler then there is the possibility that what is
set on the Client was different from that supplied.Copyright © 2016 Push Technology Ltd. All Rights Reserved.