-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use streaming response ? #1071
Comments
Hi @sydneyfunnelAIO, not sure how used you are with Ruby, but basically fb = 'https://streaming-graph.facebook.com'
conn = Faraday.new(fb)
conn.get('/9822...') do |req|
req.options.on_data = Proc.new { |chunk, size| puts chunk }
end If this works, you can then go on and change I hope this helps, please let me know how that goes |
It would be easier to help if I could try this out, however I'm not a FB developer. |
@sydneyfunnelAIO how long are you leaving the connection open before killing it? The problem I'm having -- possibly the same as you -- is that I get nothing for a long time, then suddenly a lot of data all at once. Hitting the same endpoint with curl produces a steady stream of data. I haven't yet worked out why I see this pattern. |
For everyone's info: I've spent some time investigating this with @sydneyfunnelAIO and we realised that even taking Faraday out of the equation and using plain conn = Faraday.new('https://postman-echo.com')
conn.get('/stream/500') do |req|
req.options.on_data = Proc.new do |chunk, size|
puts chunk
sleep 1
end
end and it worked exactly as expected. So we agreed there's something off with the Facebook API and this is not an issue in Faraday. |
I made a similar investigation and came to the same conclusion. The behaviour I saw was a peculiarity of one particular endpoint. |
We've added support for streaming in socketry/async-http-faraday#41 and there is an example in the tests if that's helpful. |
Basic Info
Issue description
hello i am codding a chatbot for facebook live. and I need response live comments with a link.
yeah i know u sends me link: https://lostisland.github.io/faraday/usage/streaming
but i didnt understand how must ı use it. i tried thinks. can u send me any example for that.
i am newbie on faraday[trying just for this project].
thx again...
Steps to reproduce
The text was updated successfully, but these errors were encountered: