buffet: Make periodic polling secondary if XMPP channel is up

Now that GCD server allows us to change the supported notification
channel at run-time, start with the frequent poll (every 7 seconds)
and start up XMPP channel. Once XMPP connection is established, switch
over to using XMPP as the primary command delivery mechanism and
throttle down periodic polling to once every 30 minutes.

If, for some reason, XMPP channel gets disconnected, start polling
the server frequently again, until XMPP connection is re-established.

BUG=brillo:458, brillo:713
TEST=`FEATURES=test emerge-link buffet`

Change-Id: I148a98b8229aa4597a0f6a40e596aba15265ec91
Reviewed-on: https://chromium-review.googlesource.com/273631
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
8 files changed
tree: e7ae176cf626f1e1b7a5d4d1a7e1d4bd2f28f20b
  1. buffet/