Initializing the server

First server provoke

When you’re ready to start watching for changes, the server will emulate a change to get the whole ball rolling. Here’s the Server.init code, which will provoke a push back to the client with the kind of data described in Pushing changes from Google Sheets server to client



		


This is provoked from initializing the client



		


Notice that initializing the server returns some keys so the client knows which item to watch for changes on, and also an access key to authorize it.

What happens on change detection

The client watches for changes using efx.on



		


which fires Client.poked when anything changes. It’s in that function that you decide whether to go back to the server for a data update and re-render the add-on.

The Server code

The entire server 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 Sheet server to client here