Push notifications are sent to each chrome instance even though I use only one channel-id in the request

50 views
Skip to first unread message

Aftab Baig

unread,
Jul 7, 2014, 3:31:58 PM7/7/14
to gcm-for-chr...@googlegroups.com
Push notifications are sent to each chrome instance even though I use only one channel-id in the request.
Can you guys please help ASAP.

Thanks,
Aftab Baig

Pete Williamson

unread,
Jul 7, 2014, 3:37:54 PM7/7/14
to Aftab Baig, Google
You are using the GCM for chrome V1 API, not V2, right?

It sounds like it is working as designed from the description you have provided.  The original GCM for chrome was intended to reach all signed in browsers.  The channel-id is not for identifying the browser, but so if you have a lot of traffic and some has higher priority, you can ensure that a high priority signal does not get backed up behind a bunch of low priority signals.

What are you trying to accomplish?  If I know more, I may be able to suggest a solution.


--
You received this message because you are subscribed to the Google Groups "GCM for Chrome feedback" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gcm-for-chrome-fe...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aftab Baig

unread,
Jul 7, 2014, 4:02:48 PM7/7/14
to gcm-for-chr...@googlegroups.com, afta...@gmail.com
Hi Pete,

Thanks a lot for your prompt reply.

Yes, I am using GCM for chrome V1.

I am actually developing a google chrome packaged app as a POS for a food ordering system.
In the chrome app, I sign as one of the food providers like Pizza Hut, McDonalds etc.
To sign-in, I also send the chrome instance's channel-id along with the username and password.
From the website, the user places an order to one of the providers.
The newly created order's id is sent to chrome app through a push notification to the designated provider (using the channel-id).
But instead of sending the push notification to only the selected provider, it send push notifications to all the chrome instances.

If this is an expected behaviour, is there any workaround?
Or should I need to add another other key in the payload (along with the order's id) to allow chrome app to distinguish if this order is valid for that chrome app or not? Not a cleaner approach but would work I guess.

Thanks again for your quick reply.
Waiting for your response again :)
To unsubscribe from this group and stop receiving emails from it, send an email to gcm-for-chrome-feedback+unsub...@googlegroups.com.

Pete Williamson

unread,
Jul 7, 2014, 4:25:12 PM7/7/14
to Aftab Baig, Google
Yep, as I mentioned before, channel-id doesn't do what you think it does.  

Push Messaging is designed to get a message to the user wherever the user is.  The idea is that you would have many different users all signed in to your point of sale apps using different user names and passwords from each other.

I think that I would have designed the system with a server.  When the user wants to order a pizza, a web page would send a XHR (https request) to the server.  The server would then use a web service call to the pizza providers.  Let's say the pizza providers respond with a time frame, that the pizza can be ready (or perhaps delivered) in 20 minutes.

GCM could then be used to notify the signed in user, no matter which instance of chrome they were logged into of the expected pizza ready time (or the expected pizza delivery time).

In other words, you may be trying to get GCM V1 to do something different than it was designed to do.

Here are some docs about how it was designed:

Since you are using the older version of GCM, it may be hard to find docs for how to use it properly.  You may also want to take a look at the newer version of GCM, docs are here:

Good Luck with your app!




To unsubscribe from this group and stop receiving emails from it, send an email to gcm-for-chrome-fe...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages