receive method

Receives messages from the server.

Messages that arrive before the first listener subscribes are buffered and delivered to it.

Implementation

Stream<LiveServerResponse> receive() {
  // Checked at call time: an async* body would only run on a later
  // microtask, after a socket that was open at the call may have closed.
  try {
    _checkWsStatus();
  } on LiveWebSocketClosedException catch (e, st) {
    return Stream.error(e, st);
  }
  return _controller.stream;
}