Chrome pushmessaging apis backward compatibility

a year ago, i used the following apis to enable chrome push messaging(now gcm) to send gcm messages from the server .

Those apis now seems to be completely broken

chrome.pushMessaging.getChannelId(function(google_chrome_channel_id){})

The error reported when above function is used

TypeError: Cannot read property 'getChannelId' of undefined

chrome GCM apis are changed according to this doc https://developers.google.com/cloud-messaging/chrome/client .

is there any work around for these apis or should i rewrite parts of the app according to new api ?


The old API was deprecated in May 2014. Emphasis mine:

Developers will start to see a deprecation message in the console if they use chrome.pushMessaging , and no new Chrome apps and extensions will be accepted to the Chrome Web Store if they use the deprecated API. Beginning in mid-January 2015, Chrome apps and extensions that continue to use chrome.pushMessaging will be delisted in the Chrome Web Store. When upgraded to use chrome.gcm , these apps will once again be discoverable via searching and browsing the Web Store. In early March, the chrome.pushMessaging API will be removed and all Chrome apps and extensions that continue to reference it will be automatically disabled. They can be enabled once again when upgraded to use chrome.gcm .

By now, the documentation for it no longer even exists.

So yes, you don't have a choice, you need to migrate to chrome.gcm

链接地址: http://www.djcxy.com/p/63722.html

上一篇: chrome.serial / chrome.usb未定义

下一篇: Chrome pushmessaging API向后兼容性