Google Chrome now supports push notifications for Extensions
Google’s Chrome dev team announced that Chrome extensions can now make use of Google Cloud Messaging for Chrome for push notifications so that the extensions need not poll the respective servers again and again. GCM for Chrome works in same way as GCM for Android. GCM for Chrome can be used across all channels of Chrome. All you need to do as a developer is get a token/channel ID and pass the received token to your server. Attach the token to the GCM server side API whenever you are sending a message to your app extension. The image below gives a better picture on this process. Developers can find more detail on this server here and sample apps having GCM can be found here.
Extension users on the other hand should login to Chrome using their authentication id and password and stay logged in to the browser to make use of push notifications.
Procedure to send a message (for devs):
- Request a token (channel ID) via chrome.pushMessaging.getChannelId().
- Pass the returned token to your server.
- Whenever you need to send a message to your app or extension, post the message along with the token to the GCM server-side API.
- Message delivered in real time to Chrome and triggers event page wake up
- Message delivered to chrome.pushMessaging.onMessage listener.