Retrieve Heroku App IP Address for Google Cloud Messaging

↘锁芯ラ 提交于 2019-12-25 01:59:45

问题


I am attempting to integrate Google Cloud Messaging with my Heroku Apache PHP Server so as to allow for push notification to sync app data with the server as new data arises. However, the present step in GCM requires the servers (Heroku App's) IP address to integrate with Google Cloud Messaging. In the Heroku developers console there does not appear any direct way to access the apps IP.

How can I access the Heroku App's IP address?


回答1:


I implemented GCM on heroku (but with python) and there is no need to access the dyno IP. However how Maxim Leonovich mentioned above it's not possible. But there is a addon proximo. We basically open a socket connection to gcm servers and send data. After we are finished we get all errors and deactivated devices back. The push appears on phone.




回答2:


I believe that IP address is dynamic on Heroku. When we first deployed our project there, we pinged the hostname that Heroku gave to us and used this IP in DNS record. Very quickly (in about a week) it became outdated and our project went down until we realized where's the problem.

So, you should use hostname that heroku assigns to every app if possible, otherwise you should probably invent some proxied solution using another node with known IP...



来源:https://stackoverflow.com/questions/29527684/retrieve-heroku-app-ip-address-for-google-cloud-messaging

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!