Hey there,
This is a bit of a proactive question, as I have only experimented a little while I'm waiting on the correct API keys to use this.
So, I am working on a Dashboard Panel that will grab Facebook Live comments associated with a live video id. They are available in JSON, that part is straight forward. However, they send them in an open stream that I would need to continually process, kind of like how a listener works.
So Facebook provides two suggestions in their Graph API for live comments:
var source = new EventSource("https://streaming-graph.facebook.com/[live-video-id]/live_comments?access_token=[user-access-token]&comment_rate=ten_per_second&fields=from{name,id},message");
source.onmessage = function(event) {
// Do something with event.message for example
};
or just a simple GET
GET https://streaming-graph.facebook.com/[live-video-id]/live_comments?
access_token=[user-access-token]&
comment_rate=ten_per_second&
fields=from{name,id},message
So Dashboard's javascript engine does not seem to recognize EventSource. this would be my preferred way to access this, and would be very similar to a listener on a TCP/UDP port.
Option 2 would potentially work, but the way facebook sends the posts is in a continuous stream, so I would not refresh again, I would need to keep it open and process new entries as they come. So, if I use asyncPost its probably going to write the data back but I feel like it will never finish and save as facebook will keep sending content. If there are no new posts it sends back a keep alive ping. The posts would probably make it in after the show is over and FB closes the connection.
Any good ideas on how to work with this? Is there another command similar to EventSource that I could use to open that HTTPS connection?
Also for reference, Facebook's Graph API info https://developers.facebook.com/docs/graph-api/server-sent-events/endpoints/live-comments/
Thanks!