-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Clear timeout when socket is connected #3
Comments
@lpinca yes, this makes perfect sense. Can you do a PR? Only question is – is |
I'm not sure, as I see it, it should works like this:
There could indeed be a case where the connection is opened very late and then there will be no more activity on the socket. In this condition the error event will be fire after ~ Anyway I think this is a breaking change because right now (correct me if I'm wrong) a request is aborted for example when streaming something that takes longer than |
I'll send a PR later and we can continue the discussion there, I guess. |
Right now the "connection" timer is cleared when the
response
event is emitted.There are cases where the
response
event is not emitted, for example if no data is received from the socket after connection.When this happens
timed-out
emits a connection timeout error but technically this is not correct as the connection has been established. Here is a test case:It prints the following errors:
I wonder if it makes more sense to clear the timer when the
connect
event is emitted on thesocket
:This makes
timed-out
emit a socket timeout error when the socket is connected but no data is received. The above example yields the following result:The text was updated successfully, but these errors were encountered: