-
Notifications
You must be signed in to change notification settings - Fork 45
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
Problem opening server-sent events from firebase public dataset #124
Comments
@davoclavo Hi, David. Thanks for reporting this. Could you please share what version or commit are you using? Thanks! |
@davoclavo After checking all the headers the firebase endpoint is returning, I can see the problem. I will add this as a bug and fix it as soon as possible. Thanks! |
This is what I found in cURL's source code regarding how to handle the special case where there is no ///...
else {
k->header = FALSE; /* no more header to parse! */
if((k->size == -1) && !k->chunk && !conn->bits.close &&
(conn->httpversion == 11) &&
!(conn->handler->protocol & CURLPROTO_RTSP) &&
data->set.httpreq != HTTPREQ_HEAD) {
/* On HTTP 1.1, when connection is not to get closed, but no
Content-Length nor Content-Encoding chunked have been
received, according to RFC2616 section 4.4 point 5, we
assume that the server will close the connection to
signal the end of the document. */
infof(data, "no chunk, no close, no size. Assume close to "
"signal end\n");
connclose(conn, "HTTP: No end-of-message indicator");
}
}
///... |
Whoa, nice forensic work 😄 I tested the changes on your branch. I now successfully get a reference instead of the response body, and I am able to query for events. However, the connection seems to get closed right away, (or at least that's what I understand iex> :shotgun.events(conn_pid)
[{:nofin, #Reference<0.0.2.7188>,
"event: put\ndata: {\"path\":\"/\",\"data\":{\"_credits\":\"Powered By Coinbase.com\",\"_updated\":\"Wed Dec 02 2015 01:33:55 GMT+0000 (UTC)\",\"ask\":\"352.53\",\"bid\":\"352.51\",\"last\":\"352.59\"}}"},
{:fin, #Reference<0.0.2.7188>, ""}] |
@davoclavo Indeed, I'm seeing the same behavior, I'm not sure if it is expected behavior (i.e. the server expects the SSE client to reconnect) or if it is something related to |
@jfacorro Thanks for the update! On my end I'll try to understand how |
Any update on this one? I'm also trying to use this lib in a elixir/phoenix project, first issue I had is with mix not being able to resolve deps due to version mismatch of gun (if I remember correctly) so I just created a standalone mix app but there I seem not to get the gist of using this library (also quite new to elixir 😊 ) The sse endoint on the server seems to be ok as I can get events with curl. But running shotgun from
(removed original urls and token) I might be making some basic errors here though due to my elixir/erlang inexperience. Any feedback appreciated. Thanks for the effort creating this btw! |
The issue is in Gun. It's very possible that it does not behave properly when chunked is not used. Can you open a ticket there? |
I do not seem to see this issue with Gun master. I only get "keep-alive" events though. |
Hi, awesome library!
I'm trying to use shotgun to read from firebase bitcoin event-source. If I try to read it using
curl
it works, but somehow can't get it to work withshotgun
, it gets the first response with the content-type set as "text/event-stream" but the subsequent events never show up. Any ideas of what am I doing wrong, or could it be a bug?The following example is in Elixir:
and hopefully properly translated to Erlang, which I basically copied from the example on PR #115
The text was updated successfully, but these errors were encountered: