File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1003,6 +1003,21 @@ ensure the response is a properly formatted HTTP response message.
10031003 correctly;
10041004* ` rawPacket ` : the raw packet of current request.
10051005
1006+ In some cases, the client has already received the response and/or the socket
1007+ has already been destroyed, like in case of ` ECONNRESET ` errors. Before
1008+ trying to send data to the socket, it is better to check that it is still
1009+ writable.
1010+
1011+ ``` js
1012+ server .on (' clientError' , (err , socket ) => {
1013+ if (err .code === ' ECONNRESET' || ! socket .writable ) {
1014+ return ;
1015+ }
1016+
1017+ socket .end (' HTTP/1.1 400 Bad Request\r\n\r\n ' );
1018+ });
1019+ ```
1020+
10061021### Event: ` 'close' `
10071022<!-- YAML
10081023added: v0.1.4
You can’t perform that action at this time.
0 commit comments