Interface WebsocketFactory.WebSocket

Enclosing class:
WebsocketFactory

public static interface WebsocketFactory.WebSocket
A web socket.
Author:
Holger Eichelberger, SSE
  • Method Details

    • setReceptionHander

      void setReceptionHander(Consumer<String> receptionHandler)
      Sets the reception handler for incoming messages.
      Parameters:
      receptionHandler - the response handler
    • setStatusListener

      void setStatusListener(WebsocketFactory.StatusListener listener)
      Sets the status listener.
      Parameters:
      listener - the listener
    • connect

      void connect() throws IOException
      Connects without blocking.
      Throws:
      IOException - if connection fails
    • connectBlocking

      boolean connectBlocking() throws IOException
      Connects and blocks until connected or failed.
      Returns:
      whether connecting was successful
      Throws:
      IOException - if connection fails
    • send

      void send(String text) throws IOException
      Sends the given text through the websocket.
      Parameters:
      text - the text to send
      Throws:
      IOException - if sending fails
    • close

      void close() throws IOException
      Closes the socket.
      Throws:
      IOException - if closing fails
    • closeBocking

      void closeBocking() throws IOException
      Closes the socket, waits for closing.
      Throws:
      IOException - if closing fails
    • getURI

      URI getURI()
      Returns the URI this socket is connected to.
      Returns:
      the URI
    • isOpen

      boolean isOpen()
      Returns whether the socket is open.
      Returns:
      true for open, false else
    • isClosed

      boolean isClosed()
      Returns whether the socket is closed.
      Returns:
      true for closed, false else