Support Topics Documentation Slack YouTube Blog

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


(Tomas Radvansky) #1

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.


(Mark Piller) #2

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


(Olha Danylova) #3

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


(Tomas Radvansky) #4

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)


(Tomas Radvansky) #5

Is it fixed ?


(Sergey Chupov) #6

Hi Tomas,

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


(Marcio) #7

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


(Stanislaw Grin) #8

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