Interface WebSocketReconnectHandler


  • public interface WebSocketReconnectHandler
    A reconnect handler for web socket connections. If a websocket is reconnected it will re-use the same web socket endpoint instance. Note that only a single reconnect handler instance can be registered for each deployment. If a reconnect handler wishes to save state it should store it in the session attributes
    Author:
    Stuart Douglas
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long disconnected​(jakarta.websocket.CloseReason closeReason, java.net.URI connectionUri, jakarta.websocket.Session session, int disconnectCount)
      Method that is invoked by the reconnect handler after disconnection
      long reconnectFailed​(java.io.IOException exception, java.net.URI connectionUri, jakarta.websocket.Session session, int failedCount)
      Method that is invoked if the reconnection fails
    • Method Detail

      • disconnected

        long disconnected​(jakarta.websocket.CloseReason closeReason,
                          java.net.URI connectionUri,
                          jakarta.websocket.Session session,
                          int disconnectCount)
        Method that is invoked by the reconnect handler after disconnection
        Parameters:
        closeReason - The close reason
        Returns:
        The number of milliseconds to wait for a reconnect, or -1 if no reconnect should be attempted
      • reconnectFailed

        long reconnectFailed​(java.io.IOException exception,
                             java.net.URI connectionUri,
                             jakarta.websocket.Session session,
                             int failedCount)
        Method that is invoked if the reconnection fails
        Parameters:
        exception - The failure exception
        Returns:
        The number of milliseconds to wait for a reconnect, or -1 if no reconnect should be attempted