Module bus.http

Class CoverCall.Listener

java.lang.Object
org.miaixz.bus.http.socket.WebSocketListener
org.miaixz.bus.http.plugin.httpv.CoverCall.Listener
Enclosing class:
CoverCall

public static class CoverCall.Listener extends WebSocketListener
A WebSocket listener that bridges Httpd's WebSocket events to the CoverCall's event system.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Listener(CoverCall.Client client, CoverCall webSocket)
    Constructs a new listener.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onClosed(WebSocket webSocket, int code, String reason)
    Invoked when both peers have indicated that no more messages will be transmitted and the connection has been successfully released.
    void
    onClosing(WebSocket webSocket, int code, String reason)
    Invoked when the remote peer has indicated that no more incoming messages will be transmitted.
    void
    onFailure(WebSocket webSocket, Throwable t, Response response)
    Invoked when a web socket has been closed due to an error reading from or writing to the network.
    void
    onMessage(WebSocket webSocket, String text)
    Invoked when a text (type 0x1) message has been received.
    void
    onMessage(WebSocket webSocket, org.miaixz.bus.core.io.ByteString bytes)
    Invoked when a binary (type 0x2) message has been received.
    void
    onOpen(WebSocket webSocket, Response response)
    Invoked when a web socket has been accepted by the remote peer and may begin transmitting messages.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Listener

      public Listener(CoverCall.Client client, CoverCall webSocket)
      Constructs a new listener.
      Parameters:
      client - The initiating client.
      webSocket - The CoverCall wrapper.
  • Method Details

    • onOpen

      public void onOpen(WebSocket webSocket, Response response)
      Description copied from class: WebSocketListener
      Invoked when a web socket has been accepted by the remote peer and may begin transmitting messages.
      Overrides:
      onOpen in class WebSocketListener
      Parameters:
      webSocket - The WebSocket that has been opened.
      response - The HTTP response from the upgrade request.
    • onMessage

      public void onMessage(WebSocket webSocket, String text)
      Description copied from class: WebSocketListener
      Invoked when a text (type 0x1) message has been received.
      Overrides:
      onMessage in class WebSocketListener
      Parameters:
      webSocket - The WebSocket that received the message.
      text - The text content of the message.
    • onMessage

      public void onMessage(WebSocket webSocket, org.miaixz.bus.core.io.ByteString bytes)
      Description copied from class: WebSocketListener
      Invoked when a binary (type 0x2) message has been received.
      Overrides:
      onMessage in class WebSocketListener
      Parameters:
      webSocket - The WebSocket that received the message.
      bytes - The binary content of the message.
    • onClosing

      public void onClosing(WebSocket webSocket, int code, String reason)
      Description copied from class: WebSocketListener
      Invoked when the remote peer has indicated that no more incoming messages will be transmitted.
      Overrides:
      onClosing in class WebSocketListener
      Parameters:
      webSocket - The WebSocket that is closing.
      code - The status code from the remote peer.
      reason - The reason for the closure, or an empty string.
    • onClosed

      public void onClosed(WebSocket webSocket, int code, String reason)
      Description copied from class: WebSocketListener
      Invoked when both peers have indicated that no more messages will be transmitted and the connection has been successfully released. No further calls to this listener will be made.
      Overrides:
      onClosed in class WebSocketListener
      Parameters:
      webSocket - The WebSocket that has been closed.
      code - The status code from the remote peer.
      reason - The reason for the closure, or an empty string.
    • onFailure

      public void onFailure(WebSocket webSocket, Throwable t, Response response)
      Description copied from class: WebSocketListener
      Invoked when a web socket has been closed due to an error reading from or writing to the network. Both outgoing and incoming messages may have been lost. No further calls to this listener will be made.
      Overrides:
      onFailure in class WebSocketListener
      Parameters:
      webSocket - The WebSocket that failed.
      t - The exception that caused the failure.
      response - The HTTP response from the upgrade request, or null if no response was received.