Pub/Sub message is sent as PUSH message v4.0b10

Using this settings:

let channel = “Status”,
message = status,
pubOps = new Backendless.PublishOptions({
subtopic: “CHN-” + currentUser.objectId
}),
deliveryOptions = new Backendless.DeliveryOptions({
publishPolicy:“PUBSUB”
});
Is message still delivered as PUSH message, nor pub/sub.
I tried with:pushPolicy: “PUBSUB”
Please update docs, and state all possible values for Backendless.PublishOptions and Backendless.DeliveryOptions with explanation how they work.

This has been assigned to a developer for investigation. Internal ticket number is BKNDLSS-15032

Hello Tomas,
Please update to SDK version 4.0b12 and use the code below to get only pub/sub without push:

let deliveryOptions = DeliveryOptions()
deliveryOptions.publishPolicy(PUBSUB)

and pass the deliveryOptions parameter the method

func backendless.messaging.publish(channelName: String, message: Any!, deliveryOptions: DeliveryOptions!, response: ((MessageStatus?) -> Void), error: ((Fault?) -> Void)!) -> Void

Regards, Olha

Thank you for reply,

First of all, thx for new version…I’ve installed it. Secondly I did not ask how to publish from iOS SDK. My question was how to filter messages/notification to PUB/SUB system ONLY. And as you mentioned, that option should be set as PUBSUB parameter in publish policy of delivery options, as in my case:

let channel = "Status",
    pubOps = new Backendless.PublishOptions({
        subtopic: "CHN-" + currentUser.objectId,
        headers: {
            userID: currentUser.objectId,
            userName: updateUser.name,
            status: status
        }
    }),
    deliveryOptions = new Backendless.DeliveryOptions({
        publishPolicy: "PUBSUB"
    });

That was code in JS of my custom service. But it does not work, if for any reason on
mobile device you register your device to channel = “status” and there is token assirnd
to that channel, no matter you set in publish policy, you will always receive PUSH.

So please, fix JS SDK, not IOS one…

PS. for now I removed device tokens from status channel and disabled registration for
it…But still, you should be able to decide where you want to PUSH your message or only
use PUB/SUB service (which should really be replaced by socketIO/Webrtc/MQTT or similar)

Is it fixed ?

Hi Tomas,

We’ve made a few fixes on our side, could you please verify?

Hi Guys, Backendless.Messaging.registerDevice events are counted as Pub/Sub messages? I have some Pub/Sub requests in my analytics and I’m wondering where it comes from? Regards

Hi Marcio,

registerDevice is not counted as Pub/Sub.
You may see Pub/Sub requests in your analytics because publishPolicy value in deliveryOptions is BOTH by default (meaning the message will be published as both push notification and a pub/sub message). To send it only as push notification, set publishPolicy value to PUSH.

Stanislaw

1 Like