WebSocketClient.fromClient constructor

WebSocketClient.fromClient(
  1. IWebSocketClient client, {
  2. Duration reconnectTimeout = const Duration(seconds: 5),
})

Creates a WebSocketClient from an existing IWebSocketClient. This is useful for testing or if you want to use a custom implementation with reconnecting and concurrency protection. WebSocket client. With concurrency protection and reconnecting. Supports both web and io platforms.

Implementation

WebSocketClient.fromClient(IWebSocketClient client,
    {Duration reconnectTimeout = const Duration(seconds: 5)})
    : reconnectTimeout = reconnectTimeout.abs(),
      _client = client {
  WebSocketMetricsManager.instance.startObserving(this);
}