类 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>
WebSocket connection implementation based on OkHttp WebSocket.
Supports both text (String) and binary (byte[]) message types through generic type parameter.
-
方法详细资料
-
send
从接口复制的说明:WebSocketConnectionSend 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
从接口复制的说明:WebSocketConnectionReceive 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
从接口复制的说明:WebSocketConnectionClose 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()从接口复制的说明:WebSocketConnectionCheck if connection is open.- 指定者:
isOpen在接口中WebSocketConnection<T>- 返回:
- true if connection is open
-
getCloseInfo
从接口复制的说明:WebSocketConnectionGet close information (if closed).- 指定者:
getCloseInfo在接口中WebSocketConnection<T>- 返回:
- Close info, or null if not closed
-