类 WebSocketTransportConfig

java.lang.Object
io.agentscope.core.model.transport.websocket.WebSocketTransportConfig

public class WebSocketTransportConfig extends Object
Configuration for WebSocket clients.

This class holds configuration options for WebSocket client behavior such as timeouts, heartbeat intervals, proxy settings, and SSL options.

Usage example:


 WebSocketTransportConfig config = WebSocketTransportConfig.builder()
     .connectTimeout(Duration.ofSeconds(30))
     .pingInterval(Duration.ofSeconds(30))
     .proxy(ProxyConfig.http("proxy.example.com", 8080))
     .build();

 WebSocketTransport client = OkHttpWebSocketTransport.create(config);
 
  • 字段详细资料

    • DEFAULT_CONNECT_TIMEOUT

      public static final Duration DEFAULT_CONNECT_TIMEOUT
      Default connect timeout: 30 seconds.
    • DEFAULT_READ_TIMEOUT

      public static final Duration DEFAULT_READ_TIMEOUT
      Default read timeout: 0 (no timeout for WebSocket).
    • DEFAULT_WRITE_TIMEOUT

      public static final Duration DEFAULT_WRITE_TIMEOUT
      Default write timeout: 30 seconds.
    • DEFAULT_PING_INTERVAL

      public static final Duration DEFAULT_PING_INTERVAL
      Default ping interval: 30 seconds.
  • 方法详细资料

    • getConnectTimeout

      public Duration getConnectTimeout()
      Get the connect timeout.
      返回:
      the connect timeout duration
    • getReadTimeout

      public Duration getReadTimeout()
      Get the read timeout.
      返回:
      the read timeout duration
    • getWriteTimeout

      public Duration getWriteTimeout()
      Get the write timeout.
      返回:
      the write timeout duration
    • getPingInterval

      public Duration getPingInterval()
      Get the ping interval for heartbeat (OkHttp only).
      返回:
      the ping interval duration
    • getProxyConfig

      public ProxyConfig getProxyConfig()
      Get the proxy configuration.
      返回:
      the proxy configuration, or null if no proxy is configured
    • isIgnoreSsl

      public boolean isIgnoreSsl()
      Get whether SSL certificate verification should be ignored.

      Warning: Setting this to true disables SSL certificate verification, which makes the connection vulnerable to man-in-the-middle attacks. This should only be used for testing or with trusted self-signed certificates.

      返回:
      true to ignore SSL certificate verification, false otherwise
    • builder

      public static WebSocketTransportConfig.Builder builder()
      Create a new builder for WebSocketTransportConfig.
      返回:
      a new Builder instance
    • defaults

      public static WebSocketTransportConfig defaults()
      Create a default configuration.
      返回:
      a default WebSocketTransportConfig instance