NOTE – as of 20 Nov 2017, Ephemeral exchange is migrating to a Firestore/ Firebase cloud function back end. See Migrating from App Engine to Cloud function

Receiving notifications

Initializing the server shows how the process starts off by the Server writing something to Ephemeral exchange (see also Getting started with Ephemeral Exchange for push notification

This is provoked from initializing the client

What happens on change detection

The client watches for changes using efx.on

which fires Client.poked when anything changes. In my app, here’s what this looks like. There’s quite a lot going on here, but the main points are

  • A notification doesn’t send any useful data. It just informs that there is something that needs attention, and includes the id of the cache item that should be retrieved as in { … etc })
  • You can use the packDigest and digest properties of the cache item to decide whether or not it’s necessary to visit the server to get a data update.

The Client code

The entire Client namespace is here, and is specific to my demo example, but the principle will be the similar for most use cases

For more like this, see Google Apps Scripts snippets.

Continue reading about Pushing Changes from Google Sheets to client here