ThrottleWebSocketChannel constructor

ThrottleWebSocketChannel(
  1. WebSocketChannel inner, {
  2. required ThrottleController controller,
  3. Uri? url,
})

Wraps inner, throttling it through controller.

url is used for rule matching and log display; if omitted a placeholder ws://websocket URI is used.

Implementation

ThrottleWebSocketChannel(this.inner, {required this.controller, Uri? url})
  : _url = url ?? Uri.parse('ws://websocket') {
  _stream = _wrapIncoming(inner.stream);
  _sink = _ThrottledWebSocketSink(inner.sink, controller.engine, _url);
}