subscribe method
- Set<
String> ? channels, - Set<
String> ? channelGroups, - bool withPresence = false,
- Keyset? keyset,
- String? using,
- Timetoken? timetoken,
inherited
Subscribes to channels
and channelGroups
.
Returned subscription is automatically resumed. Example:
var subscription = pubnub.subscribe(channels: {'my_test_channel'});
subscription.messages.listen((envelope) {
// handle envelope
});
Implementation
Subscription subscribe(
{Set<String>? channels,
Set<String>? channelGroups,
bool withPresence = false,
Keyset? keyset,
String? using,
Timetoken? timetoken}) {
keyset ??= keysets[using];
var manager = _getOrCreateManager(keyset);
var subscription = manager.createSubscription(
channels: channels,
channelGroups: channelGroups,
withPresence: withPresence,
timetoken: timetoken);
subscription.resume();
return subscription;
}