PubNub class Basic Features

PubNub library.

All methods on this instance accept two named parameters: keyset and using.

  • keyset accepts an instance of Keyset,
  • using accepts a String name of a keyset that was defined using pubnub.keysets.add method.

Both of those parameters are used to obtain an instance of Keyset that will be used in subsequent operations.

Example: In case of method channel, all operations on a returned Channel instance will be executed with a keyset that was obtained when the channel method was called.

At the beginning, the method that you call will try to obtain the keyset in accordance to those rules:

  • keyset parameter has the highest priority,
  • if keyset is null, it will try to obtain a keyset named using,
  • if using is null, it will try to obtain the default keyset,
  • if default keyset is not defined, it will throw an error.

Constructors

PubNub({Keyset? defaultKeyset, INetworkingModule? networking, IParserModule? parser, ICryptoModule? crypto})

Properties

batch BatchDx
Contains methods that allow running batch operations on channels, channel groups and other features.
latefinal
channelGroups ChannelGroupDx
Contains methods that allow manipulating channel groups.
latefinal
crypto ↔ ICryptoModule
Internal module responsible for cryptography.
getter/setter pairinherited
files FileDx
Contains methods that allow managing files.
latefinal
hashCode int
The hash code for this object.
no setterinherited
keysets KeysetStore
Allows to have multiple Keyset associated with one instance.
getter/setter pairinherited
networking ↔ INetworkingModule
Internal module responsible for networking.
getter/setter pairinherited
objects ObjectsDx
Contains methods to manage channel and uuids metadata and their relationships.
latefinal
parser ↔ IParserModule
Internal module responsible for parsing.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
signals Signals
Internal signals.
no setterinherited
supervisor ↔ SupervisorModule
Internal module responsible for supervising.
getter/setter pairinherited

Methods

addMessageAction({required String type, required String value, required String channel, required Timetoken timetoken, Keyset? keyset, String? using}) Future<AddMessageActionResult>
This method adds a message action to a parent message.
inherited
addPushChannels(String deviceId, PushGateway gateway, Set<String> channels, {String? topic, Environment? environment, Keyset? keyset, String? using}) Future<AddPushChannelsResult>
It registers device deviceId for push notifications from channels So the device deviceId will receive push notifications from those channels mentioned in list channels
inherited
announceHeartbeat({Keyset? keyset, String? using, Set<String> channels = const {}, Set<String> channelGroups = const {}, int? heartbeat}) Future<HeartbeatResult>
Anounce in channels and channelGroups that a device linked to the UUID in the keyset is alive.
inherited
announceLeave({Keyset? keyset, String? using, Set<String> channels = const {}, Set<String> channelGroups = const {}}) Future<LeaveResult>
Announce in channels and channelGroups that a device linked to the UUID in the keyset left.
inherited
channel(String name, {Keyset? keyset, String? using}) Channel
Returns a representation of a channel.
channelMetadata(String channelId, {String? name, String? description, Map<String, dynamic>? custom, Keyset? keyset, String? using}) Future<ChannelMetadata>
Creates ChannelMetadata and sets metadata for given channel in the database.
deleteMessageAction(String channel, {required Timetoken messageTimetoken, required Timetoken actionTimetoken, Keyset? keyset, String? using}) Future<DeleteMessageActionResult>
This method removes an existing message action (identified by actionTimetoken) from a parent message (identified by messageTimetoken) on a channel.
inherited
device(String deviceId, {Keyset? keyset, String? using}) Device
Returns a new instance of Device (from Push Notification API).
fetchMessageActions(String channel, {Timetoken? from, Timetoken? to, int? limit = 100, Keyset? keyset, String? using}) Future<FetchMessageActionsResult>
Returns all message actions of a given channel.
inherited
getState({Keyset? keyset, String? using, Set<String> channels = const {}, Set<String> channelGroups = const {}}) Future<GetUserStateResult>
inherited
getSubscribedChannelGroupsForUUID(UUID uuid, {bool countPaused = true}) Set<String>
Returns a set of channel groups that uuid is currently subscribed to.
inherited
getSubscribedChannelsForUUID(UUID uuid, {bool countPaused = true}) Set<String>
Returns a set of channels that uuid is currently subscribed to.
inherited
grant(Set<String> authKeys, {int? ttl, Set<String>? channels, Set<String>? channelGroups, Set<String>? uuids, bool? write, bool? read, bool? manage, bool? delete, bool? get, bool? update, bool? join, Keyset? keyset, String? using}) Future<PamGrantResult>
Use this method to modify permissions for provided authKeys.
inherited
grantToken(TokenRequest tokenRequest) Future<Token>
inherited
hereNow({Keyset? keyset, String? using, Set<String> channels = const {}, Set<String> channelGroups = const {}, StateInfo? stateInfo}) Future<HereNowResult>
Gets the occupancy information from a list of channels and/or channelGroups.
inherited
listPushChannels(String deviceId, PushGateway gateway, {String? topic, Environment? environment, String? start, int? count, Keyset? keyset, String? using}) Future<ListPushChannelsResult>
It returns list of all channels to which device deviceId is registered to receive push notifications.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseToken(String token) Token
inherited
publish(String channel, dynamic message, {Keyset? keyset, String? using, Map<String, dynamic>? meta, bool? storeMessage, int? ttl, bool? fire}) Future<PublishResult>
Publishes message to a channel.
inherited
reconnect() → void
Breaks up pending connections and restarts them.
inherited
removeDevice(String deviceId, PushGateway gateway, {String? topic, Environment? environment, Keyset? keyset, String? using}) Future<RemoveDeviceResult>
It is allowing for removal of all registered channels at once, for a given device deviceId, without specifying all of the channels.
inherited
removePushChannels(String deviceId, PushGateway gateway, Set<String> channels, {String? topic, Environment? environment, Keyset? keyset, String? using}) Future<RemovePushChannelsResult>
It removes registration of device deviceId from channels So device deviceId will not get push notifications from channels
inherited
requestToken({int? ttl, Map<String, dynamic>? meta, String? authorizedUUID, String? authorizedUserId, String? using, Keyset? keyset}) TokenRequest
Creates a TokenRequest that can be used to obtain a Token.
inherited
revokeToken(String token, {String? using, Keyset? keyset}) Future<PamRevokeTokenResult>
inherited
setState(dynamic state, {Keyset? keyset, String? using, Set<String> channels = const {}, Set<String> channelGroups = const {}}) Future<SetUserStateResult>
inherited
setToken(String token, {String? using, Keyset? keyset}) → void
inherited
signal(String channel, dynamic message, {Keyset? keyset, String? using}) Future<SignalResult>
Publishes signal message to a channel.
inherited
subscribe({Set<String>? channels, Set<String>? channelGroups, bool withPresence = false, Keyset? keyset, String? using, Timetoken? timetoken}) Subscription
Subscribes to channels and channelGroups.
inherited
subscription({Set<String>? channels, Set<String>? channelGroups, bool withPresence = false, Keyset? keyset, String? using, Timetoken? timetoken}) Subscription
Creates an inactive subscription to channels and channelGroups. Returns Subscription.
inherited
time() Future<Timetoken>
Get current timetoken value from the PubNub network.
inherited
toString() String
A string representation of this object.
inherited
unsubscribeAll() Future<void>
Cancels all existing subscriptions.
inherited
uuidMetadata({String? uuid, String? name, String? email, Map<String, dynamic>? custom, String? externalId, String? profileUrl, Keyset? keyset, String? using}) Future<UUIDMetadata>
Creates UUIDMetadata and sets metadata for given uuid in the database.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

version String
Current version of this library.
getter/setter pair