You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 5-network/08-websocket/article.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,7 @@ For instance:
124
124
125
125
`Sec-WebSocket-Extensions` is sent by the browser automatically, with a list of possible extensions it supports.
126
126
127
-
`Sec-WebSocket-Protocol`is depends on us: we decide what kind of data we send. The second optional parameter of `new WebSocket` lists subprotocols:
127
+
`Sec-WebSocket-Protocol` depends on us: we decide what kind of data we send. The second optional parameter of `new WebSocket` lists subprotocols:
128
128
129
129
```js
130
130
let socket =newWebSocket("wss://javascript.info/chat", ["soap", "wamp"]);
@@ -250,7 +250,7 @@ There are other codes like:
250
250
251
251
Please refer to the [RFC6455, §7.4.1](https://tools.ietf.org/html/rfc6455#section-7.4.1) for the full list.
252
252
253
-
WebSocket codes are somewhat like HTTP codes, but different. In particular, an codes less than `1000` are reserved, there'll be an error if we try to set such a code.
253
+
WebSocket codes are somewhat like HTTP codes, but different. In particular, any codes less than `1000` are reserved, there'll be an error if we try to set such a code.
254
254
255
255
```js
256
256
// in case connection is broken
@@ -360,7 +360,7 @@ You can also download it (upper-right button in the iframe) and run locally. Jus
360
360
361
361
## Summary
362
362
363
-
WebSocket is a modern way to have persisten browser-server connections.
363
+
WebSocket is a modern way to have persistent browser-server connections.
364
364
365
365
- WebSockets don't have cross-origin limitations.
366
366
- They are well-supported in browsers.
@@ -378,7 +378,7 @@ Events:
378
378
-`error`,
379
379
-`close`.
380
380
381
-
WebSocket by itself does not include reconnection, authentication and many other high-level mechanisms. So there are client/server libraries add them. But it's also possible to implement these manually and integrate WebSockets with an existing site.
381
+
WebSocket by itself does not include reconnection, authentication and many other high-level mechanisms. So there are client/server libraries that add them. But it's also possible to implement these manually and integrate WebSockets with an existing site.
382
382
383
383
For integration purposes, a WebSocket server is usually running in parallel with the main server, and they share a single database. Requests to WebSocket use `wss://ws.site.com`, a subdomain that leads to WebSocket server, while `https://site.com` goes to the main HTTP-server.
0 commit comments