Travel Time AJAX v. Web sockets

I would like to ask whether one should expect some different round-trip time (sending some information to the server and receiving a response) when implemented with web sockets (message) compared to standard HTTP GET. I assume that the web socket is already connected and DNS is resolved.

As I understand it, it would be different if the GET consisted of several hits in the underlying protocol, which I'm not sure about. Otherwise, I would expect the same results.

+5
source share
2 answers

It depends on the source scenario you are considering.

1: HTTP 1.1 , WebSocket . , TCP-, . (: , , , , , ).

2: HTTP 1.1 ( , , ), WebSocket . , HTTP , WebSocket. , HTTP TCP TCP ( ). WebSockets TCP- WS, .

+2

WebSockets, , . , 100 :

Local:
WebSocket:   2.46ms
Ajax:        9.97ms

Remote:
WebSocket:  93.41ms
Ajax:      183.49ms

Node.js express socket.io Chrome socket.io . 3G.

: :

Websocket:  63.02ms
Ajax:       72.11ms

, HTTP-, WebSocket, , , , HTTP , , .

+18

All Articles