Publish in the Future¶
The example demonstrates scheduling a message to be delivered on January 1st, 2030 at 00:00 Central time. The message is published into the demo
channel:
String channelName = "demo";
DeliveryOptions deliveryOptions = new DeliveryOptions();
DateTime publishDate = DateTime.fromMillisecondsSinceEpoch(1893477600000);
deliveryOptions.publishAt = publishDate;
Backendless.messaging.publish("Happy New Year!", channelName: channelName,
deliveryOptions: deliveryOptions).then((status) {
print("Message has been published");
});
Codeless Reference
To subscribe to a channel refer to the Subscribe for All Messages topic.
where:
Argument | Description |
---|---|
channel name |
Name of the channel where a message must be published to. |
subtopic name |
The subtopic of the message allows developers to designate and filter messages by subtopic name. For instance, if a messaging application has a group and a few subgroups, all messages sent to the main group can be marked with this subtopic name which can be used to route messages to the appropriate subgroups depending on the context. |
message |
The contents of the message that must be published to a channel. |
headers |
Message headers is a collection of name/value pairs. A subscriber can set a filter expressed as an SQL "where clause" query (called selector) which Backendless uses to determine whether a message should be delivered to the subscriber. When the query matches the published data in message headers, message is delivered to the corresponding subscriber. For more information see the Conditional Delivery section of this guide. |
publish at |
Must be a Unix Timestamp, which is the number of milliseconds since the Epoch (January 1st, 1970 at UTC). Note that if you want to specify the number of seconds instead of milliseconds, you must multiply the number by 1000 or add three trailing zeroes to your number (e.g. (1681324179 * 1000) or 1681324179000 . |
return result |
When this box is checked, the operation returns an object containing the status of the message delivery and a unique message identifier. |
Returns an object containing the status of the message delivery and a unique message identifier:
// Sample object
{
"errorMessage":null,
"messageId":"message:FCBD8BF1-A45D-4564-B449-3C91D4896987",
"status":"published"
}
The example below publishes the message to the "demo"
channel. The publish at
property has been set to publish the message at 1893477600000
Unix time.