Support Topics Documentation Slack YouTube Blog

Pub/Sub messaging (with push support) 4.0b9


(Tomas Radvansky) #1

Hello again, I am trying to achieve similar solution I’ve created for v3.0 but I am struggling.

Please find attached project to illustrate the issue:

Basic send:







p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #d12f1b}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4f8187}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008400}
span.s1 {font-variant-ligatures: no-common-ligatures}
span.s2 {font-variant-ligatures: no-common-ligatures; color: #ba2da2}
span.s3 {font-variant-ligatures: no-common-ligatures; color: #4f8187}
span.s4 {font-variant-ligatures: no-common-ligatures; color: #000000}
span.s5 {font-variant-ligatures: no-common-ligatures; color: #31595d}
span.s6 {font-variant-ligatures: no-common-ligatures; color: #d12f1b}
span.s7 {font-variant-ligatures: no-common-ligatures; color: #3e1e81}



  let publishOptions = PublishOptions()

        publishOptions.publisherId = "5DF302D1-CBFC-9D3A-FF64-71D1B84CEC00"

        let deliveryOption:DeliveryOptions = DeliveryOptions()

        //deliveryOption.pushPolicy(PUSH_ALSO)

        Backendless.sharedInstance().messaging.publish("CHN-626EC44A-5DAA-3B34-FFB0-A733BB011A00", message: message, publishOptions: publishOptions, deliveryOptions: deliveryOption, response: { (msgStatus:MessageStatus?) in

            print(msgStatus)

        }) { (err:Fault?) in

            print(err?.message != nil ? err!.message : "")

        }

Basic subscribe:







p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4f8187}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008400}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000}
span.s1 {font-variant-ligatures: no-common-ligatures; color: #000000}
span.s2 {font-variant-ligatures: no-common-ligatures; color: #ba2da2}
span.s3 {font-variant-ligatures: no-common-ligatures}
span.s4 {font-variant-ligatures: no-common-ligatures; color: #4f8187}
span.s5 {font-variant-ligatures: no-common-ligatures; color: #31595d}
span.s6 {font-variant-ligatures: no-common-ligatures; color: #d12f1b}
span.s7 {font-variant-ligatures: no-common-ligatures; color: #3e1e81}



 let subOptions:SubscriptionOptions = SubscriptionOptions()

        //subOptions.deliveryMethod(DELIVERY_POLL)

        Backendless.sharedInstance().messaging.subscribe("CHN-626EC44A-5DAA-3B34-FFB0-A733BB011A00", subscriptionResponse: { (messages:[Message]?) in

            print(messages)

        }, subscriptionError: { (error:Fault?) in

            print(error?.message != nil ? error!.message : "")

        }, subscriptionOptions: subOptions, response: { (sub:BESubscription?) in

            print(sub)

        }, error: { (error:Fault?) in

            print(error?.message != nil ? error!.message : "")

        })

This I’ve done only for purposes of illustrating issue, but I tried using custom logic (using JS) with same result. App seems to be properly registered with channel, device token is registered too. But every time I publish message, it receives proper status - scheduled. But no message is received.


(Anton Govorushkin) #2

Hello Tomas

We will test this and report you back shortly. Thanks for reporting

Regards Anton


(Anton Govorushkin) #3

Tomas

We can’t reproduce the issue on our environment. All messages are being successfully delivered. We have several questions for you:

  1. Have you uploaded certificate for push notifications in developers console (.p12 file) - Manage > App settings > Mobile?
  2. Have you enabled push notifications at Target/Capabilities tab in Xcode?
  3. Is this channel name? CHN-626EC44A-5DAA-3B34-FFB0-A733BB011A00 You should set the channel name here
Backendless.sharedInstance().messaging.subscribe("CHN-626EC44A-5DAA-3B34-FFB0-A733BB011A00", subscriptionResponse: { (messages:[Message]?) in
print(messages)
}, subscriptionError: { (error:Fault?) in
print(error?.message != nil ? error!.message : "")
}, subscriptionOptions: subOptions, response: { (sub:BESubscription?) in
print(sub)
}, error: { (error:Fault?) in
print(error?.message != nil ? error!.message : "")
})

Regards Anton


(Tomas Radvansky) #4

1, p12 file should not make any difference in pub/sub communication dont you think ?

2, same as 1 (but yes)
3, Yes CHN-626EC44A-5DAA-3B34-FFB0-A733BB011A00 is channel name

push notification (while app is in background works)


(Mark Piller) #5

Tomas,

You’re right, .p12 certificate does not make any difference for pub/sub, neither does device token, btw.

Could you check if the published message shows up in the Messages listing on the Messaging screen? (make sure to select the right channel)

Regards,
Mark


(Tomas Radvansky) #6

Yes, messages are correctly sent, and I can see them online (portal)

But subscription itself does not work…even though I receive success response (I have subscription object)…but this bit is not called at all:

subscriptionResponse: { (messages:[Message]?) in
print(messages)
},

(Mark Piller) #7

What’s the app ID? I will try subscription from a JS client to rule out the server-side.