Unsubscribe from PushNotification Channel

0 votes

Hello, 

I create 5 channels in App42HQ 

With my app I subscribe to one channel (calling subscribeToChannel ) , and I receive the notifications: this is good.

Now I call unsubscribeFromChannel and I receive an error 1705: "User by name xxx  not subscribed for channel yyy"

If I try to call subscribeToChannel Again I receive the error  1704: "User by name xxx  already subscribed for channel yyy"

Why I cannot unsubscribe from channel ?

I need help.

 

G. Fain

asked Jul 6, 2014 in App42 Cloud API-BaaS by odf (37 points)
Can you please share some more details like which SDK version your are working on or if it is possible than share the logs when you called subscribeToChannel function ?
Hello I use Java SDK version 1.9 or JS SDk versione 2.6 the result is the same.
The java code that I use for subscibe or unsubscribe is the example that I find in your website.
I make first a subscribe and after an unsubscribe
The log is  :
21:39:42,681  INFO CampionatiView:458 - Avvio Applicazione
21:39:42,730  INFO ConfigValues:196 - Carico configurazione
21:39:49,362 ERROR CampionatiView:1090 - jComboBoxRegioniItemStateChanged:Can not refresh not managed object: [Ljava.lang.Object;@2feda244.
21:40:04,881 DEBUG SingleClientConnManager:214 - Get connection for route HttpRoute[{s}->https://api.shephertz.com]
21:40:07,625 DEBUG DefaultClientConnectionOperator:145 - Connecting to api.shephertz.com/54.245.94.33:443
21:40:09,025 DEBUG RequestAddCookies:130 - CookieSpec selected: best-match
21:40:09,079 DEBUG DefaultHttpClient:620 - Attempt 1 to execute request
21:40:09,080 DEBUG DefaultClientConnection:264 - Sending request: POST /cloud/1.0/push/subscribeToChannel/03010? HTTP/1.1
21:40:09,099 DEBUG headers:268 - >> POST /cloud/1.0/push/subscribeToChannel/03010? HTTP/1.1
21:40:09,099 DEBUG headers:271 - >> Content-Type: application/json
21:40:09,100 DEBUG headers:271 - >> Accept: application/json
21:40:09,100 DEBUG headers:271 - >> signature: -----%3D
21:40:09,101 DEBUG headers:271 - >> version: 1.0
21:40:09,101 DEBUG headers:271 - >> SDKName: Java
21:40:09,102 DEBUG headers:271 - >> timeStamp: 2014-07-07T19:40:03.887Z
21:40:09,102 DEBUG headers:271 - >> apiKey: -----
21:40:09,103 DEBUG headers:271 - >> Content-Length: 57
21:40:09,103 DEBUG headers:271 - >> Host: api.shephertz.com
21:40:09,103 DEBUG headers:271 - >> Connection: Keep-Alive
21:40:09,384 DEBUG DefaultClientConnection:249 - Receiving response: HTTP/1.1 400 Bad Request
21:40:09,385 DEBUG headers:252 - << HTTP/1.1 400 Bad Request
21:40:09,386 DEBUG headers:255 - << Access-Control-Allow-Headers: Content-Type,Accept,apiKey,signature,timeStamp,sessionId,adminKey,fbAccessToken,dataACL,geoTag,selectKeys,SDKName,deviceId,event,version,userList,deletePermanent,loggedInUser,dbCredentials,metaQuery,emailAuth,orderByDescending,orderByAscending,jsonObject,offset,max,dataEncoding
21:40:09,387 DEBUG headers:255 - << Access-Control-Allow-Methods: GET, POST,HEAD, OPTIONS,PUT, DELETE
21:40:09,388 DEBUG headers:255 - << Access-Control-Allow-Origin: *
21:40:09,389 DEBUG headers:255 - << Access-Control-Max-Age: 10
21:40:09,390 DEBUG headers:255 - << app42Fault: 400
21:40:09,390 DEBUG headers:255 - << Cache-Control: no-cache
21:40:09,391 DEBUG headers:255 - << Content-Type: application/json
21:40:09,391 DEBUG headers:255 - << Date: Mon, 07 Jul 2014 19:40:08 GMT
21:40:09,391 DEBUG headers:255 - << message: {"app42Fault":{"httpErrorCode":400,"appErrorCode":1704,"message":"BAD REQUEST","details":"User by the name xxxx already subscribed for the channel yyyy"}}
21:40:09,392 DEBUG headers:255 - << Server: Apache-Coyote/1.1
21:40:09,392 DEBUG headers:255 - << transfer-encoding: chunked
21:40:09,393 DEBUG headers:255 - << Connection: keep-alive
21:40:09,416 DEBUG DefaultHttpClient:477 - Connection can be kept alive indefinitely
21:40:09,427 DEBUG SingleClientConnManager:269 - Releasing connection org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@12097c94
21:40:16,391 DEBUG SingleClientConnManager:214 - Get connection for route HttpRoute[{s}->https://api.shephertz.com]
21:40:16,393 DEBUG DefaultClientConnectionOperator:145 - Connecting to api.shephertz.com/54.245.94.33:443
21:40:17,268 DEBUG RequestAddCookies:130 - CookieSpec selected: best-match
21:40:17,270 DEBUG DefaultHttpClient:620 - Attempt 1 to execute request
21:40:17,271 DEBUG DefaultClientConnection:264 - Sending request: PUT /cloud/1.0/push/unsubscribeToChannel/03010? HTTP/1.1
21:40:17,284 DEBUG headers:268 - >> PUT /cloud/1.0/push/unsubscribeToChannel/03010? HTTP/1.1
21:40:17,284 DEBUG headers:271 - >> Content-Type: application/json
21:40:17,285 DEBUG headers:271 - >> Accept: application/json
21:40:17,286 DEBUG headers:271 - >> signature: ------%3D
21:40:17,286 DEBUG headers:271 - >> version: 1.0
21:40:17,287 DEBUG headers:271 - >> SDKName: Java
21:40:17,287 DEBUG headers:271 - >> timeStamp: 2014-07-07T19:40:16.346Z
21:40:17,288 DEBUG headers:271 - >> apiKey: ------
21:40:17,289 DEBUG headers:271 - >> Content-Length: 57
21:40:17,289 DEBUG headers:271 - >> Host: api.shephertz.com
21:40:17,290 DEBUG headers:271 - >> Connection: Keep-Alive
21:40:17,292 DEBUG wire:77 - >> "{"push":{"channel":{"name":"yyyy","userName":"xxxx"}}}"
21:40:17,604 DEBUG DefaultClientConnection:249 - Receiving response: HTTP/1.1 404 Not Found
21:40:17,605 DEBUG headers:252 - << HTTP/1.1 404 Not Found
21:40:17,606 DEBUG headers:255 - << Access-Control-Allow-Headers: Content-Type,Accept,apiKey,signature,timeStamp,sessionId,adminKey,fbAccessToken,dataACL,geoTag,selectKeys,SDKName,deviceId,event,version,userList,deletePermanent,loggedInUser,dbCredentials,metaQuery,emailAuth,orderByDescending,orderByAscending,jsonObject,offset,max,dataEncoding
21:40:17,607 DEBUG headers:255 - << Access-Control-Allow-Methods: GET, POST,HEAD, OPTIONS,PUT, DELETE
21:40:17,608 DEBUG headers:255 - << Access-Control-Allow-Origin: *
21:40:17,609 DEBUG headers:255 - << Access-Control-Max-Age: 10
21:40:17,609 DEBUG headers:255 - << app42Fault: 404
21:40:17,610 DEBUG headers:255 - << Cache-Control: no-cache
21:40:17,610 DEBUG headers:255 - << Content-Type: application/json
21:40:17,611 DEBUG headers:255 - << Date: Mon, 07 Jul 2014 19:40:17 GMT
21:40:17,611 DEBUG headers:255 - << message: {"app42Fault":{"httpErrorCode":404,"appErrorCode":1705,"message":"NOT FOUND","details":"User by the name xxxx not subscribed for the channel yyyy"}}
21:40:17,612 DEBUG headers:255 - << Server: Apache-Coyote/1.1
21:40:17,612 DEBUG headers:255 - << transfer-encoding: chunked
21:40:17,613 DEBUG headers:255 - << Connection: keep-alive
21:40:17,614 DEBUG DefaultHttpClient:477 - Connection can be kept alive indefinitely
21:40:17,618 DEBUG SingleClientConnManager:269 - Releasing connection org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@3a05f913

4 Answers

0 votes

Hello I update to Java Sdk 2.3 but the result is the same, 

when I go to unsubscribe a User I receive this message:

16:30:21,128 DEBUG headers:252 - << HTTP/1.1 404 Not Found
16:30:21,129 DEBUG headers:255 - << Access-Control-Allow-Headers: Content-Type,Accept,apiKey,signature,timeStamp,sessionId,adminKey,fbAccessToken,dataACL,geoTag,selectKeys,SDKName,deviceId,event,version,userList,deletePermanent,loggedInUser,dbCredentials,metaQuery,emailAuth,orderByDescending,orderByAscending,jsonObject,offset,max,dataEncoding
16:30:21,129 DEBUG headers:255 - << Access-Control-Allow-Methods: GET, POST,HEAD, OPTIONS,PUT, DELETE
16:30:21,130 DEBUG headers:255 - << Access-Control-Allow-Origin: *
16:30:21,130 DEBUG headers:255 - << Access-Control-Max-Age: 10
16:30:21,131 DEBUG headers:255 - << app42Fault: 404
16:30:21,131 DEBUG headers:255 - << Cache-Control: no-cache
16:30:21,132 DEBUG headers:255 - << Content-Type: application/json
16:30:21,132 DEBUG headers:255 - << Date: Tue, 08 Jul 2014 14:30:20 GMT
16:30:21,133 DEBUG headers:255 - << message: {"app42Fault":{"httpErrorCode":404,"appErrorCode":1705,"message":"NOT FOUND","details":"User by the name xxx not subscribed for the channel yyyy"}}
16:30:21,133 DEBUG headers:255 - << Server: Apache-Coyote/1.1
16:30:21,134 DEBUG headers:255 - << transfer-encoding: chunked
16:30:21,134 DEBUG headers:255 - << Connection: keep-alive
answered Jul 8, 2014 by odf (37 points)
0 votes
Any one can help me ?
answered Jul 9, 2014 by odf (37 points)
+1 vote
Hello Fain,

Our sincere apologies for the delay in replying this. We were getting this thing tested internally thus a small delay.

In this case system was removing a random device out of multiple devices subscribed by the user. This defect is fixed now and now you can unsubscribe all devices of the user.

This was the defect from server side so it should work with latest SDK you have. Please test it once and update us.

Thanks for your patience again.

 

/Shashank
answered Jul 10, 2014 by sshukla480 (407 points)
0 votes
Thanks,

I make a small test and I think the problem is solved.

If I can ask you, is very usefull to have a function to get all channels where a user is subscribed.

 

Best resgards
answered Jul 10, 2014 by odf (37 points)
Yes, sure we will definitely add this feature request in our next release, And we will update this thread ones it's complete.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...