Skip to content

Commit 355e35d

Browse files
committedAug 26, 2022
closes #3162

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

Diff for: ‎5-network/11-websocket/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Sec-WebSocket-Version: 13
9191
- `Origin` -- the origin of the client page, e.g. `https://javascript.info`. WebSocket objects are cross-origin by nature. There are no special headers or other limitations. Old servers are unable to handle WebSocket anyway, so there are no compatibility issues. But the `Origin` header is important, as it allows the server to decide whether or not to talk WebSocket with this website.
9292
- `Connection: Upgrade` -- signals that the client would like to change the protocol.
9393
- `Upgrade: websocket` -- the requested protocol is "websocket".
94-
- `Sec-WebSocket-Key` -- a random browser-generated key for security.
94+
- `Sec-WebSocket-Key` -- a random browser-generated key, used to ensure that the server supports WebSocket protocol. It's random to prevent proxies from caching any following communication.
9595
- `Sec-WebSocket-Version` -- WebSocket protocol version, 13 is the current one.
9696

9797
```smart header="WebSocket handshake can't be emulated"
@@ -107,7 +107,7 @@ Connection: Upgrade
107107
Sec-WebSocket-Accept: hsBlbuDTkk24srzEOTBUlZAlC2g=
108108
```
109109

110-
Here `Sec-WebSocket-Accept` is `Sec-WebSocket-Key`, recoded using a special algorithm. The browser uses it to make sure that the response corresponds to the request.
110+
Here `Sec-WebSocket-Accept` is `Sec-WebSocket-Key`, recoded using a special algorithm. Upon seeing it, the browser understands that the server really does support the WebSocket protocol.
111111

112112
Afterwards, the data is transferred using the WebSocket protocol, we'll see its structure ("frames") soon. And that's not HTTP at all.
113113

0 commit comments

Comments
 (0)
Please sign in to comment.