Client notifications
A publisher can opt to receive certain notifications regarding clients. It does this by adding a ClientListener which can be the publisher itself or any other object that implements the ClientListener interface.
A listener is added using the Publishers.addEventListener method.
All notifications are passed a reference to the client in question which can be interrogated for further information as required.
Notifications received on the ClientListener interface are as follows:
clientConnected | This is called whenever a new client connects. It is not necessarily a client that is subscribing to one of the publisher's topics. |
clientResolved | This is called when a newly connected client is resolved. A client's full geographical information is not necessarily available as soon as a client connects and so this method is called separately after the client has been resolved. |
clientSubscriptionInvalid | This is called whenever a client attempts to subscribe to a topic that does not exist. This might be because the topic is not yet available and this gives a publisher the opportunity to create the topic and subscribe the client to it. |
clientFetchInvalid | This is called whenever a client attempts to fetch a topic that does not exist. This gives the publisher the opportunity to respond to fetch request on a non-existent topic. A publisher can even reply to such a request without having to create a topic using the sendFetchReply method. |
clientSendInvalid | This is called whenever a client attempts to send a message to a topic that does not exist, or to which the client is not subscribed. This enables a client to send a message to a topic and for that topic to be created and subscribed to on demand, or send data when a response is never expected. |
clientQueueThresholdReached | This is called whenever a client's queue breaches an upper queue notification threshold or returns to a lower queue notification threshold. Parameters indicate which threshold has been reached and the threshold value. |
clientCredentials | This is called whenever a client supplies new credentials after connection. It is called after the authentication handlers have validated the credentials. |
clientClosed | This is called whenever a client disconnects. The reason for disconnection can be obtained using theClient.getCloseReason method. |