Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In NodeJS, if I don't respond to a request, can anything negative happen to my server?

Tags:

node.js

I have a nodeJS server running. There are some requests that the server will receive that don't need a response (just updating in the server). If the update fails, it isn't something that the client will need to worry about. In order to save bandwidth, I'd like to not respond to said requests. Can not responding to requests somehow affect my server's performance?

like image 769
thisissami Avatar asked Nov 04 '22 19:11

thisissami


1 Answers

Assuming you are using http, You have to at least return an http response code. If you don't you are violating http -- the client is going to wait for a response, and will die trying (i.e. will timeout after a while).

According to the documentation for end, you must call end for every response. That is going to send a response code for you, if you don't specify one. So yes, need to respond.

like image 72
hvgotcodes Avatar answered Nov 11 '22 05:11

hvgotcodes