Package com.vaadin.client.communication
Interface ConnectionStateHandler
-
- All Known Implementing Classes:
DefaultConnectionStateHandler
public interface ConnectionStateHandler
Interface for handling problems and other events which occur during communication with the server. The handler is responsible for handling any problem in XHR, heartbeat and push connections in a way it sees fit. The default implementation isDefaultConnectionStateHandler
.- Since:
- 7.6
- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
configurationUpdated()
Called when some part of the reconnect dialog configuration has been changed.void
heartbeatException(com.google.gwt.http.client.Request request, Throwable exception)
Called when an exception occurs during aHeartbeat
requestvoid
heartbeatInvalidStatusCode(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response)
Called when a heartbeat request returns a status code other than OK (200)void
heartbeatOk()
Called when aHeartbeat
request succeedsvoid
pushClientTimeout(PushConnection pushConnection, com.google.gwt.core.client.JavaScriptObject response)
Called when a client side timeout occurs before a push connection to the server completes.void
pushClosed(PushConnection pushConnection, com.google.gwt.core.client.JavaScriptObject responseObject)
Called when the push connection to the server is closed.void
pushError(PushConnection pushConnection, com.google.gwt.core.client.JavaScriptObject response)
Called when a fatal error fatal error occurs in the push connection.void
pushInvalidContent(PushConnection pushConnection, String message)
Called when invalid content (not JSON) was pushed from the server through the push connectionvoid
pushNotConnected(JsonObject payload)
Called when a message is to be sent to the server through the push channel but the push channel is not connectedvoid
pushOk(PushConnection pushConnection)
Called when the push connection to the server has been established.void
pushReconnectPending(PushConnection pushConnection)
Called when the push connection has lost the connection to the server and will proceed to try to re-establish the connectionvoid
pushScriptLoadError(String resourceUrl)
Called when the required push script could not be loadedvoid
setConnection(ApplicationConnection connection)
Sets the application connection this instance is connected to.void
xhrException(XhrConnectionError xhrConnectionError)
Called when an exception occurs during an XmlHttpRequest request to the server.void
xhrInvalidContent(XhrConnectionError xhrConnectionError)
Called when invalid content (not JSON) was returned from the server as the result of an XmlHttpRequest requestvoid
xhrInvalidStatusCode(XhrConnectionError xhrConnectionError)
Called when invalid status code (not 200) was returned by the server as the result of an XmlHttpRequest.void
xhrOk()
Called whenever a XmlHttpRequest to the server completes successfully
-
-
-
Method Detail
-
setConnection
void setConnection(ApplicationConnection connection)
Sets the application connection this instance is connected to. Called internally by the framework.- Parameters:
connection
- the application connection this instance is connected to
-
heartbeatException
void heartbeatException(com.google.gwt.http.client.Request request, Throwable exception)
Called when an exception occurs during aHeartbeat
request- Parameters:
request
- The heartbeat requestexception
- The exception which occurred
-
heartbeatInvalidStatusCode
void heartbeatInvalidStatusCode(com.google.gwt.http.client.Request request, com.google.gwt.http.client.Response response)
Called when a heartbeat request returns a status code other than OK (200)- Parameters:
request
- The heartbeat requestresponse
- The heartbeat response
-
heartbeatOk
void heartbeatOk()
Called when aHeartbeat
request succeeds
-
pushClosed
void pushClosed(PushConnection pushConnection, com.google.gwt.core.client.JavaScriptObject responseObject)
Called when the push connection to the server is closed. This might result in the push connection trying a fallback connection method, trying to reconnect to the server or might just be an indication that the connection was intentionally closed ("unsubscribe"),- Parameters:
pushConnection
- The push connection which was closedresponse
- An object containing response data
-
pushClientTimeout
void pushClientTimeout(PushConnection pushConnection, com.google.gwt.core.client.JavaScriptObject response)
Called when a client side timeout occurs before a push connection to the server completes. The client side timeout causes a disconnection of the push connection and no reconnect will be attempted after this method is called,- Parameters:
pushConnection
- The push connection which timed outresponse
- An object containing response data
-
pushError
void pushError(PushConnection pushConnection, com.google.gwt.core.client.JavaScriptObject response)
Called when a fatal error fatal error occurs in the push connection. The push connection will not try to recover from this situation itself and typically the problem handler should not try to do automatic recovery either. The cause can be e.g. maximum number of reconnection attempts have been reached, neither the selected transport nor the fallback transport can be used or similar.- Parameters:
pushConnection
- The push connection where the error occurredresponse
- An object containing response data
-
pushReconnectPending
void pushReconnectPending(PushConnection pushConnection)
Called when the push connection has lost the connection to the server and will proceed to try to re-establish the connection- Parameters:
pushConnection
- The push connection which will be reconnected
-
pushOk
void pushOk(PushConnection pushConnection)
Called when the push connection to the server has been established.- Parameters:
pushConnection
- The push connection which was established
-
pushScriptLoadError
void pushScriptLoadError(String resourceUrl)
Called when the required push script could not be loaded- Parameters:
resourceUrl
- The URL which was used for loading the script
-
xhrException
void xhrException(XhrConnectionError xhrConnectionError)
Called when an exception occurs during an XmlHttpRequest request to the server.- Parameters:
xhrConnectionError
- An event containing what was being sent to the server and what exception occurred
-
xhrInvalidContent
void xhrInvalidContent(XhrConnectionError xhrConnectionError)
Called when invalid content (not JSON) was returned from the server as the result of an XmlHttpRequest request- Parameters:
communicationProblemEvent
- An event containing what was being sent to the server and what was returned
-
xhrInvalidStatusCode
void xhrInvalidStatusCode(XhrConnectionError xhrConnectionError)
Called when invalid status code (not 200) was returned by the server as the result of an XmlHttpRequest.- Parameters:
communicationProblemEvent
- An event containing what was being sent to the server and what was returned
-
xhrOk
void xhrOk()
Called whenever a XmlHttpRequest to the server completes successfully
-
pushNotConnected
void pushNotConnected(JsonObject payload)
Called when a message is to be sent to the server through the push channel but the push channel is not connected- Parameters:
payload
- The payload to send to the server
-
pushInvalidContent
void pushInvalidContent(PushConnection pushConnection, String message)
Called when invalid content (not JSON) was pushed from the server through the push connection- Parameters:
communicationProblemEvent
- An event containing what was being sent to the server and what was returned
-
configurationUpdated
void configurationUpdated()
Called when some part of the reconnect dialog configuration has been changed.
-
-