I\'m in the process of building a Sonos iPhone app with Swift using the Sonos API but have hit a stumbling block. I would like to detect when a state/volume / metadata change on
You must host a service to receive events. Your server should satisfy all of these requirements:
Your event service should also verify the X-Sonos-Event-Signature of each event it receives. See Subscribe on the Sonos developer portal for details.
Enter your callback URL in the form field for your Control integration.
You should receive an HTTP POST to your callback URL when states change in the namespace to which you subscribed. For example, if you subscribed to the groupVolume namespace for a group, you should receive a group volume event when the group volume changes. Try changing the group volume in the Sonos app and verify that your callback URL gets an event.
Here's a sample group volume event from the documentation, sent after a change in the volume state:
POST {YOUR_CALLBACK_BASE_URL} HTTP/1.1
Content-Type: application/json
Content-Length: 41
X-Sonos-Household-Id: Sonos_1234567890
X-Sonos-Event-Seq-Id: 1234
X-Sonos-Event-Signature: 90192js8cjhvd7ebcjsfdfw
X-Sonos-Namespace: groupVolume
X-Sonos-Type: groupVolume
X-Sonos-Target-Type: groupId
X-Sonos-Target-Value: RINCON_00012345678001400:0
{"volume":16,"muted":false,"fixed":false}