Making an asynchronous request to some server using the httpc
HTTP client
httpc:request(get, {Url, []}, [], [{sync, false}, {stream,
self}])
where Url
is the URL of the server. Data is received by
handle_info/2
in gen_server
that called httpc:request/4
but I should get message when the connection is broken and there is no stream_end
message. Using timeout is not feasible for me, because server response can take a long time.
Is it possible to get message about a broken connection in handle_info/2
? If not, please suggest way to know when the connection is broken?
For more heavy-duty lifting of HTTP requests, use ibrowse:
https://github.com/cmullaparthi/ibrowse
It has many more knobs to twist and turn for requests and is more complete w.r.t. many things. If http/httpc doesn't solve your problem, it is worth investigating if going to ibrowse will.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With