类 OkHttpWebSocketConnection<T>

java.lang.Object
io.agentscope.core.model.transport.websocket.OkHttpWebSocketConnection<T>
类型参数:
T - Message type: String for text protocol, byte[] for binary protocol
所有已实现的接口:
WebSocketConnection<T>

public class OkHttpWebSocketConnection<T> extends Object implements WebSocketConnection<T>
WebSocket connection implementation based on OkHttp WebSocket.

Supports both text (String) and binary (byte[]) message types through generic type parameter.

  • 方法详细资料

    • send

      public reactor.core.publisher.Mono<Void> send(T data)
      从接口复制的说明: WebSocketConnection
      Send a message.

      Implementation should:

      • Log at DEBUG level before sending
      • Log at TRACE level with message size
      • Wrap errors in WebSocketTransportException using onErrorMap
      • Log errors at ERROR level with full context
      指定者:
      send 在接口中 WebSocketConnection<T>
      参数:
      data - Message data (String or byte[])
      返回:
      Mono that completes when send is done, or emits WebSocketTransportException on error
    • receive

      public reactor.core.publisher.Flux<T> receive()
      从接口复制的说明: WebSocketConnection
      Receive message stream.

      The returned Flux:

      • Completes when connection is closed normally
      • Emits error (WebSocketTransportException) on connection failure
      • Logs each received message at TRACE level

      Implementation should:

      • Log received messages at TRACE level with size
      • Wrap errors in WebSocketTransportException using onErrorMap
      • Log errors at ERROR level with connection context
      指定者:
      receive 在接口中 WebSocketConnection<T>
      返回:
      Message stream (String or byte[])
    • close

      public reactor.core.publisher.Mono<Void> close()
      从接口复制的说明: WebSocketConnection
      Close the connection.

      Implementation should:

      • Log at INFO level with close code and reason
      • Send WebSocket close frame with code 1000 (normal closure)
      • Clean up resources
      指定者:
      close 在接口中 WebSocketConnection<T>
      返回:
      Mono that completes when connection is closed
    • isOpen

      public boolean isOpen()
      从接口复制的说明: WebSocketConnection
      Check if connection is open.
      指定者:
      isOpen 在接口中 WebSocketConnection<T>
      返回:
      true if connection is open
    • getCloseInfo

      public CloseInfo getCloseInfo()
      从接口复制的说明: WebSocketConnection
      Get close information (if closed).
      指定者:
      getCloseInfo 在接口中 WebSocketConnection<T>
      返回:
      Close info, or null if not closed