subscribe method

bool subscribe(
  1. String topic
)

Implementation

bool subscribe(String topic) {
  if (_closed) throw Exception('Subscribe on closed Subscriber');
  var ret = _subscriptions.putIfAbsent(topic, () => <Subscriber>{}).add(this);
  _localSubs.add(topic);
  if (_sticky.containsKey(topic)) {
    var stickyVal = _sticky[topic];
    if (stickyVal != null) {
      _send(stickyVal);
    }
  }
  return ret;
}