WebSockets: useful for reducing overhead?

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?

+8
javascript websocket overhead
source share
1 answer

WebSockets seems to provide better performance in situations like yours.

Web search

  • small handshake title
  • full duplex after establishing a connection.
  • After establishing a connection, only 2 bytes are added to each transmitted request / response

Http

  • Http headers are sent along with each request

WebSocket, on the other hand, is a relatively new technology. It would be prudent to investigate the capabilities of a web browser related to network problems.

Ref:

http://websocket.org/quantum.html

http://www.youtube.com/watch?v=Z897fkPn7Rw

http://en.wikipedia.org/wiki/WebSocket#Browser_support

+3
source share

All Articles