Interface PushSendListener
- All Known Implementing Classes:
PushSessionTracker
public interface PushSendListener
Component notified when a UIDL message is sent to the client via PUSH
mechanism.
The component is also notified when the PUSH connection is established in order to perform initialization tasks for the connected resource.
Implementation must be thread safe, since method invocation may originate in different threads.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanPush()Determines if a push operation should be performed or not.default voidonConnect(org.atmosphere.cpr.AtmosphereResource resource) Invoked when a new PUSH connection is established.voidonMessageSent(org.atmosphere.cpr.AtmosphereResource resource) Invoked whenever a UIDL message has been sent to the client.
-
Method Details
-
onConnect
default void onConnect(org.atmosphere.cpr.AtmosphereResource resource) Invoked when a new PUSH connection is established.- Parameters:
resource- theAtmosphereResourcebehind the PUSH connection.
-
onMessageSent
void onMessageSent(org.atmosphere.cpr.AtmosphereResource resource) Invoked whenever a UIDL message has been sent to the client.- Parameters:
resource- theAtmosphereResourceused to process the message
-
canPush
default boolean canPush()Determines if a push operation should be performed or not.This method is invoked before the actual push operation is performed. Implementors can decide to block the operation and thus postpone the application of pending changes to the UI. Preventing PUSH is useful, for example, when a server is shutting down, to prevent disalignments between the server and the client while the session is transferred to another server.
The default implementation always returns true.
- Returns:
- true if the current push operation should be performed, false otherwise.
-