setDestinationSink method

void setDestinationSink(
  1. WebSocketSink destinationSink
)

Sets a sink as the destination for events from the WebSocketSinkCompleter's sink.

The completer's sink will act exactly as destinationSink.

If the destination sink is set before events are added to sink, further events are forwarded directly to destinationSink.

If events are added to sink before setting the destination sink, they're buffered until the destination is available.

A destination sink may be set at most once.

Implementation

void setDestinationSink(WebSocketSink destinationSink) {
  if (_sink._destinationSink != null) {
    throw StateError('Destination sink already set');
  }
  _sink._setDestinationSink(destinationSink);
}