Publish with 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.
The following example publishes a message with the city : Tokyo
header:
var channel = "TestChannel",
message = "Hello, world!",
pubOps = new Backendless.PublishOptions({
headers: {
city: "Tokyo"
}
});
Backendless.Messaging.publish( channel, message, pubOps )
.then( function( response ) {
})
.catch( function( error ) {
});