publish method

Future<PublishResult> publish(
  1. dynamic message, {
  2. bool? storeMessage,
  3. int? ttl,
  4. dynamic meta,
  5. bool? fire,
})

Publishes message to a channel name.

You can override the default account configuration on message saving using storeMessage flag - true to save and false to discard. Leave this option unset if you want to use the default.

meta parameter is for providing additional information with message that can be used for stream filtering

  • Inorder to make stream filtering work, Provide valid Object as meta.
  • Invalid type (e.g String) data won't be passed to server.

To send message to PubNub BLOCKS EventHandler, set fire param value to true. Fire message is not replicated, and so will not be received by any subscribers to the channel. Fire message is also not stored in history.

You can set a per-message time to live in storage using ttl option. If set to 0, message won't expire. If unset, expiration will fall back to default.

Implementation

Future<PublishResult> publish(dynamic message,
    {bool? storeMessage, int? ttl, dynamic meta, bool? fire}) {
  return _core.publish(name, message,
      storeMessage: storeMessage,
      ttl: ttl,
      keyset: _keyset,
      meta: meta,
      fire: fire);
}