Search code examples
sonos

How to send heart beat (ping) to music service from SONOS controller


I just want to find out music from my service is currently playing or not? Usually for our Android or iOS client we used to send a heart beat (ping) to service to notify client is alive, how can implement the same in SONOS. I've tried with getLastUpdate by setting pollinterval but it seems it is getting called only when my controller is in foreground.

Thanks in Advance.


Solution

  • We have several reporting methods that should help you accomplish this kind of reporting. reportPlaySeconds (http://musicpartners.sonos.com/node/388) is probably your best bet, as it will tell you how long a listener was listening to a track (and thus that playback is occurring) and allow you to set the interval at which this is reported back to you. In the future, reportPlayStatus (http://musicpartners.sonos.com/node/389) should also be able to help you track playback (although currently this is only reporting on skip events).