I’m using the webhook API for stream change notifications, and am quite frequently receiving duplicate notifications.
In particular, if the initial notification for a stream has 0 viewers, a second notification will be generated a little later when there are non-0 viewers.
Most of the time the duplicate notification has the same notification ID, so it can be easily filtered out, but sometimes this isn’t the case. Some recent examples of notifications IDs where only the viewer count has changed:
2018-10-22 14:49:16,951 INFO Notification: d63cc350-7963-5b43-aa61-9717b02cc550
2018-10-22 14:51:16,752 INFO Notification: 1555266d-e54e-5145-9fcb-722a2c01a06d
2018-10-19 21:43:03,460 INFO Notification: e7c1df85-b5c9-5c93-bfe0-8bc18003ab6b
2018-10-19 21:43:14,858 INFO Notification: 66e554c0-aff2-5fcb-8dd5-00849a24c465
This wasn’t a problem until the changes to the stream webhook at the start of the month, so I don’t think it’s something I’m doing wrong (although I’m happy to be corrected. )
Let me know if there’s any more information I can provide on this issue.
The data processing is handed off to a separate process so that the webhook handler can return as soon as possible. Apache logs show the response time of the webhook handler is usually a 2ms or less.
On closer inspection, I’ve noticed a difference between the duplicate notifications - the language tag. On the first notification it’s
"language":""
On the second/duplicate:
"language":"en" or "en-gb"
This looks like the initial notification has not correctly picked up the language of the stream.
Another oddity is that it is inconsistent as to whether the notification ID changes, even though the language data has.
if you get a second notification with an existing ID, then it’s a resend.
Try doing HTTP/1.1 200 Ok and actually printing Ok.
There could be something else awry but if the problem of dupes continues let us know I can poke someone to take a look. We’d need the clientID that you are using.