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.
Mixed-in types

Constructors

PubNub.new({Keyset? defaultKeyset, INetworkingModule? networking, IParserModule? parser, ICryptoModule? crypto, LoggingConfiguration? logging})

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
logger → dynamic
The logger for this PubNub instance
no setterinherited
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 → dynamic
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 dynamic timetoken, dynamic 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, dynamic 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({dynamic 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({dynamic 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.
cleanupLogging() Future<void>
Clean up logging resources for this instance
inherited
deleteMessageAction(String channel, {required dynamic messageTimetoken, required dynamic actionTimetoken, dynamic 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).
dispose() Future<void>
Dispose of this PubNub instance and clean up resources.
fetchMessageActions(String channel, {dynamic from, dynamic to, int? limit = 100, dynamic keyset, String? using}) Future<FetchMessageActionsResult>
Returns all message actions of a given channel.
inherited
getState({dynamic keyset, String? using, Set<String> channels = const {}, Set<String> channelGroups = const {}}) Future<GetUserStateResult>
inherited
getSubscribedChannelGroupsForUUID(dynamic uuid, {bool countPaused = true}) Set<String>
Returns a set of channel groups that uuid is currently subscribed to.
inherited
getSubscribedChannelsForUUID(dynamic 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, dynamic keyset, String? using}) Future
Use this method to modify permissions for provided authKeys.
inherited
grantToken(TokenRequest tokenRequest) Future<Token>
inherited
hereNow({dynamic 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
initializeLogging(LoggingConfiguration? config, String instanceId) → void
Initialize logging for this instance
inherited
listPushChannels(String deviceId, PushGateway gateway, {String? topic, Environment? environment, String? start, int? count, dynamic 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, {dynamic keyset, String? using, Map<String, dynamic>? meta, bool? storeMessage, int? ttl, bool? fire, String? customMessageType}) 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, dynamic 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, dynamic 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({required int? ttl, Map<String, dynamic>? meta, String? authorizedUUID, String? authorizedUserId, String? using, dynamic keyset}) TokenRequest
Creates a TokenRequest that can be used to obtain a Token.
inherited
revokeToken(String token, {String? using, dynamic keyset}) Future
inherited
setLogLevel(int level) → void
Change the log level dynamically for this instance
inherited
setState(dynamic state, {dynamic keyset, String? using, Set<String> channels = const {}, Set<String> channelGroups = const {}}) Future<SetUserStateResult>
inherited
setToken(String token, {String? using, dynamic keyset}) → void
inherited
signal(String channel, dynamic message, {String? customMessageType, dynamic keyset, String? using}) Future<SignalResult>
Publishes signal message to a channel.
inherited
subscribe({Set<String>? channels, Set<String>? channelGroups, bool withPresence = false, dynamic keyset, String? using, dynamic timetoken}) Subscription
Subscribes to channels and channelGroups.
inherited
subscription({Set<String>? channels, Set<String>? channelGroups, bool withPresence = false, dynamic keyset, String? using, dynamic timetoken}) Subscription
Creates an inactive subscription to channels and channelGroups. Returns Subscription.
inherited
time() Future
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