Class EventWebSocket.InternalEventListener

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void onClose​(java.net.http.WebSocket webSocket, int statusCode, java.lang.String reason)
      Receives close messages.
      void onError​(java.net.http.WebSocket webSocket, java.lang.Throwable t)
      Called when an Exception is detected.
      void onMessage​(java.net.http.WebSocket webSocket, HiroMessage message)
      Called with an incoming message.
      void onOpen​(java.net.http.WebSocket webSocket)
      Sets the filters, scopes and calls EventWebSocket.TokenRefreshHandler.start().
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • eventWebSocketListener

        protected final EventWebSocketListener eventWebSocketListener
        Reference to the external listener
    • Constructor Detail

      • InternalEventListener

        public InternalEventListener​(EventWebSocketListener listener)
        Constructor
        Parameters:
        listener - The listener which received messages.
    • Method Detail

      • onOpen

        public void onOpen​(java.net.http.WebSocket webSocket)
                    throws java.io.IOException,
                           java.util.concurrent.ExecutionException,
                           java.lang.InterruptedException,
                           java.util.concurrent.TimeoutException
        Sets the filters, scopes and calls EventWebSocket.TokenRefreshHandler.start().
        Specified by:
        onOpen in interface SpecificWebSocketListener
        Parameters:
        webSocket - The webSocket using this HiroWebSocketListener.
        Throws:
        java.lang.InterruptedException - On interrupt on sending.
        java.io.IOException - On IO errors or when messages cannot be parsed to JSON strings.
        java.util.concurrent.ExecutionException - When sending fails generally.
        java.util.concurrent.TimeoutException - When sending of data took longer than AuthenticatedWebSocketHandler.webSocketRequestTimeout ms.
      • onMessage

        public void onMessage​(java.net.http.WebSocket webSocket,
                              HiroMessage message)
                       throws java.lang.Exception
        Description copied from interface: SpecificWebSocketListener
        Called with an incoming message.
        Specified by:
        onMessage in interface SpecificWebSocketListener
        Parameters:
        webSocket - Reference to the websocket.
        message - The incoming HiroMessage.
        Throws:
        java.lang.Exception - Any Exception
      • onClose

        public void onClose​(java.net.http.WebSocket webSocket,
                            int statusCode,
                            java.lang.String reason)
        Receives close messages.

        This will stop the EventWebSocket.tokenRefreshHandler.

        Specified by:
        onClose in interface SpecificWebSocketListener
        Parameters:
        webSocket - Reference to the websocket.
        statusCode - Status code sent from the remote side.
        reason - Reason text sent from the remote side.
      • onError

        public void onError​(java.net.http.WebSocket webSocket,
                            java.lang.Throwable t)
        Description copied from interface: SpecificWebSocketListener
        Called when an Exception is detected. Does nothing on default.
        Specified by:
        onError in interface SpecificWebSocketListener
        Parameters:
        webSocket - Reference to the websocket.
        t - The Throwable thrown.