I create a dynamic search (updated with every keystroke): my current scheme is to send a new AJAX request to the server and return the data to JSON with each keystroke.
I considered opening a WebSocket for each search session to save some overhead. I know this will save time, but the question is whether it really costs, given these parameters: 80 ms average ping time 166ms: time between each keystroke, assuming the user types relatively quickly The worst data rate is 1 MB / s, and each data packet should be received at each key press no more than 1 KB. The application also takes about 30-40 ms to weld the search results in the DOM.
I found this: HTTP vs Websockets regarding overhead , but it was a different use case.
Will websockets reduce anything beyond pure HTTP overhead? How much does HTTP overhead cost (in the absence of cookies and minimal headers)?
I assume that HTTP requests open a new network socket for each request, and WebSocket allows us to use it only once. If my understanding is correct, what is the actual overhead of opening a new network socket?
Ivo
source share