ESP8266 – Google Cloud Messaging without external server

I was looking into a solution to send push notifications from an ESP8266 module to an Android application. I know that this is possible with the Google Cloud Messaging service.

But what I found on the internet is using an external webserver, able to run PHP (or Python) scripts and using a MySQL server to store registration IDs. So the information flow looks like:

The developer opensĀ a project in the Google Developer Console, gets an API key and uses this API key in the Android application to register an Android phone or tablet (or watch or TV) on the Google GCM server. The GCM server sends back a registration ID to the Android device. The Android app then needs to send this registration ID to (your own) external webserver where it is stored and used to send push messages to the Android device.

The device that wants to send a message to the registered Android devices then uses a PHP script to send data to the GCM server, which then creates and sends a push message to the Android devices.

So far so good, but why do I need to setup an external server with MySQL and PHP just to send messages to the Android devices. The ESP8266 has server capabilities build-in and has enough storage to save registration IDs in the Flash memory.

The solution would look like:


The registration IDs would be stored in the ESP8266 and the ESP8266 would contact the GCM server directly to request push messages to the registered Android devices.

 

As I could not find any tutorial or example on the Internet how to achieve this, I started to write the code by myself.

The result is not (yet) a library that you can just link to your ESP8266 code, it is more a collection of functions that you can copy into your code to use the ESP8266 to send push messages via GCM.

The requirements are listed on the next page.

Loading...
Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Leave a Reply

Your email address will not be published. Required fields are marked *

Free Link Directory