What is the difference in behavior between HTTP Stay-Alive and Websockets?

Recently, I have been working with websockets. Created my own server and there is a public demonstration . I do not have such detailed experience or knowledge: http. (Although, since websocket requests are being updated with HTTP requests, I have some.)

At my end, the server reports each hit. Among them, there are a bunch of HTTP stay requests. My server does not process them because they are not websocket requests. But it aroused my curiosity.

The whole big thing about websites is that the connection remains alive. Then you can send messages in both directions (even at the same time). I read that the Stay-Alive HTTP connection is a relatively new development (I don’t know how old people are, just that it’s only included in the very latest standard - 1.1) - is this really old?)

I suppose I can assume that there is a difference in behavior between the two, or would there be no reason for the websocket standard? Who cares?

+14
source share
3 answers

A Keep Alive HTTP header, HTTP 1.0, HTTP-, HTTP-. TCP- HTTP-. , , , - HTTP-/. , .

WebSocket - , , . , , .

: 1) http://en.wikipedia.org/wiki/HTTP_persistent_connection 2) http://en.wikipedia.org/wiki/WebSocket

+27

COMET, , HTTP Keep-Alive. Keep-Alive 12 , HTTP. , ; - . "" , ; , .

+7

HTTP vs Websockets

REST (HTTP)

  • , , .
  • HTTP . "", , .
  • HTTP , , .
  • .
  • HTTP v1.1 , , .

, HTTP , ...

  • , , .
  • .
  • , .
  • . : WebSocket , , ?

WebSockets

  • WebSocket - , .
  • WebSocket , . , WebSockets REST, HTTP/ .
  • ( ), WebSocket.
  • " " .
  • WebSockets , HTTP-/, .

, WebSockets , ..

  • , - .
  • WebSockets .
  • WebSocket, , , .
  • / .
  • The resulting design is price independent. Ask yourself: Is an HTTP solution substantially less effort for designing, implementing, testing, and working?

Link: https://blogs.windows.com/buildingapps/2016/03/14/when-to-use-a-http-call-instead-of-a-websocket-or-http-2-0/

+1
source

All Articles