createStreamChannel method

StreamChannel<SerializableEntity> createStreamChannel()

Creates a new StreamChannel for the endpoint.

If a previous channel already exists it will be closed, meaning the StreamChannel.stream will emit the done event and adding more messages to theStreamChannel.sink will have no effect.

Implementation

StreamChannel<SerializableEntity> createStreamChannel() {
  resetStream();

  final controller = StreamChannelController<SerializableEntity>(
    allowForeignErrors: false,
  );
  unawaited(_setupController(controller));
  return controller.foreign;
}