Page 1 of 1

Problem with SubscribeChannel and UnsubscribeChannel services

Posted: Thu Oct 24, 2013 4:45 pm
by anelezeravla

Hello,

I'm following the "sending push notifications to a device" and "sending push notifications from 3rd party apps" tutorials and I have succeded in completing both. Services work ok, test works fine and I can suscribe and unsubscribe from test services. I manage the subscription states with a GetChannels services.

My problem is the following:

I want a toggle control, e.g., when value changes, call to subscribe or unsubscribe services:

if (Appery('mobiletoggle_31').val()=="on"){
localStorage.setItem("recibirAvisos", "on");
rsSubscribeUser.execute();
}else{
localStorage.setItem("recibirAvisos", "off");
rsUnsubscribeUser.execute();
}

rsSubscribeUser and rsUnsubscribeUser are datasources that call to SubscribeChannels and UnsubscribeChannel respectively.

When debugging the application in browser I receive a 400 Bad Request error (see attached image) with this response:

{"code":"PNSI007","description":"Serializationerror"}
and the device not is subscribe to channel:

[
{
"id":2080,
"name":"channel1",
"subscribed":false
}
]

Any ideas?

Thanks in advance.

Image


Problem with SubscribeChannel and UnsubscribeChannel services

Posted: Thu Oct 24, 2013 6:07 pm
by Kateryna Grynko

Hi,

Please share the application with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and tell us how to reproduce the error. We'll take a look.


Problem with SubscribeChannel and UnsubscribeChannel services

Posted: Fri Oct 25, 2013 10:12 am
by anelezeravla

Thanks Katya, I have shared the app. In order to reproduce the error, follow these steps:

The startScreen has a toggle control (mobiletoggle_31). When this control changes its value, a call is made to the SubscribeChannels and UnsubscribeChannel respectively. This datasources use RESTServices SubscribeChannels and UnsubscribeChannel using default params. This params are my channel and my deviceId.

When debugging the application in browser I receive a 400 Bad Request error with this response:

{"code":"PNSI007","description":"Serializationerror"}

Thank you.


Problem with SubscribeChannel and UnsubscribeChannel services

Posted: Fri Oct 25, 2013 10:26 am
by Maryna Brodina

Hello! Could you tell us your app name?


Problem with SubscribeChannel and UnsubscribeChannel services

Posted: Fri Oct 25, 2013 10:30 am
by anelezeravla

DemosJS


Problem with SubscribeChannel and UnsubscribeChannel services

Posted: Fri Oct 25, 2013 11:12 am
by Maryna Brodina

channels should be an array, not a string. That's why in services rsSubscribeUser and rsUnsubscribeUser in request parameters for parameter channels add the following JS code:
prereturn [2093];/pre