Class StringWebSocketClient

java.lang.Object
io.appium.java_client.ws.StringWebSocketClient
All Implemented Interfaces:
CanHandleConnects, CanHandleDisconnects, CanHandleErrors, CanHandleMessages<String>, Consumer<org.openqa.selenium.remote.http.Message>, org.openqa.selenium.remote.http.WebSocket.Listener

public class StringWebSocketClient extends Object implements org.openqa.selenium.remote.http.WebSocket.Listener, CanHandleMessages<String>, CanHandleErrors, CanHandleConnects, CanHandleDisconnects
  • Constructor Details

    • StringWebSocketClient

      public StringWebSocketClient(org.openqa.selenium.remote.http.HttpClient httpClient)
  • Method Details

    • getEndpoint

      public @Nullable URI getEndpoint()
    • isListening

      public boolean isListening()
    • connect

      public void connect(URI endpoint)
      Connects web socket client.
      Parameters:
      endpoint - The full address of an endpoint to connect to. Usually starts with 'ws://'.
    • onOpen

      public void onOpen()
      The callback method invoked on websocket opening.
    • onClose

      public void onClose(int code, String reason)
      Specified by:
      onClose in interface org.openqa.selenium.remote.http.WebSocket.Listener
    • onError

      public void onError(Throwable t)
      Specified by:
      onError in interface org.openqa.selenium.remote.http.WebSocket.Listener
    • onText

      public void onText(CharSequence data)
      Specified by:
      onText in interface org.openqa.selenium.remote.http.WebSocket.Listener
    • getMessageHandlers

      public List<Consumer<String>> getMessageHandlers()
      Description copied from interface: CanHandleMessages
      Returns a list of all registered web socket messages handlers.
      Specified by:
      getMessageHandlers in interface CanHandleMessages<String>
      Returns:
      The list of web socket message handlers.
    • getErrorHandlers

      public List<Consumer<Throwable>> getErrorHandlers()
      Description copied from interface: CanHandleErrors
      Returns a list of all registered web socket error handlers.
      Specified by:
      getErrorHandlers in interface CanHandleErrors
      Returns:
      The list of web socket error handlers.
    • getConnectionHandlers

      public List<Runnable> getConnectionHandlers()
      Description copied from interface: CanHandleConnects
      Returns a list of all registered web socket connection handlers.
      Specified by:
      getConnectionHandlers in interface CanHandleConnects
      Returns:
      The list of web socket connection handlers.
    • getDisconnectionHandlers

      public List<Runnable> getDisconnectionHandlers()
      Description copied from interface: CanHandleDisconnects
      Returns a list of all registered web socket disconnection handlers.
      Specified by:
      getDisconnectionHandlers in interface CanHandleDisconnects
      Returns:
      The list of web socket disconnection handlers.
    • removeAllHandlers

      public void removeAllHandlers()
      Remove all the registered handlers.