push method

  1. @internal
Push push(
  1. ChannelEvents event,
  2. Map<String, dynamic> payload, [
  3. Duration? timeout
])

Implementation

@internal
Push push(
  ChannelEvents event,
  Map<String, dynamic> payload, [
  Duration? timeout,
]) {
  if (!joinedOnce) {
    throw "tried to push '${event.eventName()}' to '$topic' before joining. Use channel.subscribe() before pushing events";
  }
  final pushEvent = Push(this, event, payload, timeout ?? _timeout);
  if (canPush) {
    pushEvent.send();
  } else {
    pushEvent.startTimeout();
    _pushBuffer.add(pushEvent);
  }

  return pushEvent;
}