-
Notifications
You must be signed in to change notification settings - Fork 57
Fail to understand how I should handle connection failures from a client. #184
Comments
Looks like this is an area we need to tighten up a bit. I'll look into it. |
I have solved the problem by listening on |
Good, ok. I'm going to add a commit to the initial PR that attempts to refine this just a bit. It should not impact the actual flow here so you shouldn't need to change anything. Essentially the flow is this: On the client side, when the Socket emits an On the server side, it's the same except that a default listener for the The big caveat, however, is that application should should never write directly to the Socket associated with an |
Fixes: #184 Refines the `'socketError'` event a bit and adds a test for the emission of the `'socketError'` event on the server. Client side is tested separately
Fixes: #184 Refines the `'socketError'` event a bit and adds a test for the emission of the `'socketError'` event on the server. Client side is tested separately
Fixes: #184 Refines the `'socketError'` event a bit and adds a test for the emission of the `'socketError'` event on the server. Client side is tested separately
Fixes: nodejs/http2#184 Refines the `'socketError'` event a bit and adds a test for the emission of the `'socketError'` event on the server. Client side is tested separately PR-URL: nodejs#14239 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Fixes: nodejs/http2#184 Refines the `'socketError'` event a bit and adds a test for the emission of the `'socketError'` event on the server. Client side is tested separately Backport-PR-URL: #14813 Backport-Reviewed-By: Anna Henningsen <[email protected]> Backport-Reviewed-By: Timothy Gu <[email protected]> PR-URL: #14239 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
I am trying to construct a client that will handle failure conditions correctly. I am currently testing a situation where the client tries to connect to a server that is not running. I can see at the socket level a tls.connect is failing with "Connection Refused", but this doesn't seem to be translating into anything I can use.
Here is a promise I am trying to create for the session
but that promise never resolves.
In a previous attempt, I didn't wait for the connection to establish, and after creating the connection immediately created a request - something like this
In that scenario, the 'end' event was raised pretty quickly - but no error.event. Unfortunately that makes it very difficult to understand why the 'end' event was raised, so I didn't pursue it.
What is the correct way of dealing with this? docs don't give much clue.
The text was updated successfully, but these errors were encountered: