Backendless Support
 
Solved

Pub/Sub messaging (with push support) 4.0b9

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:

https://github.com/radvansky-tomas/Backendless4CrashReport

Basic send:

  1. 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:

  1. 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.

Leave a Comment

Comments (20)

photo
1

Hello Tomas

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

Regards Anton

photo
1

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

  1. Backendless.sharedInstance().messaging.subscribe("CHN-626EC44A-5DAA-3B34-FFB0-A733BB011A00", subscriptionResponse: { (messages:[Message]?) in
  2. print(messages)
  3. }, subscriptionError: { (error:Fault?) in
  4. print(error?.message != nil ? error!.message : "")
  5. }, subscriptionOptions: subOptions, response: { (sub:BESubscription?) in
  6. print(sub)
  7. }, error: { (error:Fault?) in
  8. print(error?.message != nil ? error!.message : "")
  9. })

Regards Anton

photo
1

Can you confirm that you can run my example and you receive messages in closure:

  1. { (messages:[Message]?) in
  2. print(messages)
  3. }

photo
photo
1

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)

photo
1

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

photo
1

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:

  1. subscriptionResponse: { (messages:[Message]?) in
  2. print(messages)
  3. },

photo
1

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

photo
1

02E0B487-71CE-DB1E-FF7F-79892D128500

photo
1

Thanks. Could you publish a few messages please? I have a subscriber waiting on messages.

photo
1

fe079a24b9aa5542af02dc7f3d1e421e

Done

photo
1

I got a message with a JS client, so the backend is working then:

83cb1b86620512d5fcd3b74f10467c22

This must be a problem with the iOS client then. I will open a ticket to investigate this further.

Here's JS fiddle I used for testing (make sure to put your app id and API key):

https://jsfiddle.net/n2h95a31/

Regards,

Mark

photo
1

Yes, that why I sent iOS source code for investigation, I am sure that this is problem of subscribing and pooling messages, not backend. But as far as we still dont have access to SDK, its hard to debug these issues

photo
1

What do you mean you do not have access to the SDK? It's been in github all along:

https://github.com/Backendless/ios-SDK/tree/4.0

You're welcome to dig into it and if you find a bug, submit a pull request, we'd welcome any contribution from the community!

photo
1

:D thats not SDK...

SDK is this file: https://github.com/Backendless/ios-SDK/blob/4.0/SDK/ios/backendless/backendless.a

And unless you perform some sort of reverse engineering you can't access source code

photo
1

All it takes is just a few clicks through the github tree.. the source code is certainly there, we have no other repository for it:

https://github.com/Backendless/ios-SDK/tree/4.0/SDK/backendlessAPI/Classes

photo
1

the file you pointed out is the compiled library from the very source code which is in the same repository.

photo
1

Ok, then I will try to include whole project instead of cocoapod and debug it (but probably tomorrow)...if somebody could look into this it would be great, as far as I dont know your source...but I will certainly study it and contribute

photo
1

Hey Tomas,

Our iOS engineer is already working on that. For reference, the internal ticket ID is BKNDLSS-14949.

photo
1

Please check the new release 4.0b10, should work fine now.

Regards, Olga

photo
1

Thats better:P

Thank you very much...