Interface SpecificWebSocketListener

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void onClose​(java.net.http.WebSocket webSocket, int statusCode, java.lang.String reason)
      Called right before the websocket is about to close.
      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)
      Called right after the websocket has been opened.
    • Method Detail

      • onOpen

        void onOpen​(java.net.http.WebSocket webSocket)
             throws java.util.concurrent.ExecutionException,
                    java.lang.InterruptedException,
                    java.util.concurrent.TimeoutException,
                    java.io.IOException
        Called right after the websocket has been opened. Does nothing on default.
        Parameters:
        webSocket - Reference to the websocket.
        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 a timeout in ms.
      • onMessage

        void onMessage​(java.net.http.WebSocket webSocket,
                       HiroMessage message)
                throws java.lang.Exception
        Called with an incoming message.
        Parameters:
        webSocket - Reference to the websocket.
        message - The incoming HiroMessage.
        Throws:
        java.lang.Exception - Any Exception
      • onClose

        void onClose​(java.net.http.WebSocket webSocket,
                     int statusCode,
                     java.lang.String reason)
              throws WebSocketException
        Called right before the websocket is about to close. Does nothing on default.
        Parameters:
        webSocket - Reference to the websocket.
        statusCode - Status code sent from the remote side.
        reason - Reason text sent from the remote side.
        Throws:
        WebSocketException - If the WebSocket has errors on closing.
      • onError

        void onError​(java.net.http.WebSocket webSocket,
                     java.lang.Throwable t)
        Called when an Exception is detected. Does nothing on default.
        Parameters:
        webSocket - Reference to the websocket.
        t - The Throwable thrown.