Skip to content

Commit 8ca414f

Browse files
committed
Translated "Reconnection" except one phrase, marked with ???
1 parent 5d351c4 commit 8ca414f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

5-network/12-server-sent-events/article.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,38 +85,38 @@ let source = new EventSource("https://another-site.com/events", {
8585
Please see the chapter <info:fetch-crossorigin> for more details about cross-domain headers.
8686

8787

88-
## Reconnection
88+
## Переподключение
8989

90-
Upon creation, `new EventSource` connects to the server, and if the connection is broken -- reconnects.
90+
После создания, `new EventSource` подключается к серверу и, если соединение обрывается, -- переподключается.
9191

92-
That's very convenient, as we don't have to care about it.
92+
Это очень удобно, так как нам не приходится беспокоиться об этом.
9393

9494
There's a small delay between reconnections, a few seconds by default.
9595

96-
The server can set the recommended delay using `retry:` in response (in milliseconds):
96+
Сервер может выставить рекомендуемую задержку, указав в ответе `retry:` (в милисекундах):
9797

9898
```js
9999
retry: 15000
100-
data: Hello, I set the reconnection delay to 15 seconds
100+
data: Привет, я выставил задержку переподключения в 15 секунд
101101
```
102102

103-
The `retry:` may come both together with some data, or as a standalone message.
103+
Поле `retry:` может посылаться как вместе с данными, так и отдельным сообщением.
104104

105-
The browser should wait that much before reconnect. If the network connection is lost, the browser may wait till it's restored, and then retry.
105+
Браузер должен быть подождать окончания задержки перед попыткой переподключения. Если потеряно подключение к интернету, бразуер может дождаться его востанновления и затем попытаться переподключиться.
106106

107-
- If the server wants the browser to stop reconnecting, it should respond with HTTP status 204.
108-
- If the browser wants to close the connection, it should call `eventSource.close()`:
107+
- Если сервер хочет остановить попытки переподключения, он должен ответить со статусом 204.
108+
- Если браузер хочет прекратить соединение, он может вызвать `eventSource.close()`:
109109

110110
```js
111111
let eventSource = new EventSource(...);
112112

113113
eventSource.close();
114114
```
115115

116-
Also, there will be no reconnection if the response has an incorrect `Content-Type` or its HTTP status differs from 301, 307, 200 and 204. The connection the `"error"` event is emitted, and the browser won't reconnect.
116+
Также переподключение не произойдет, если в ответе указан неверный `Content-Type` или его статус отличается от 301, 307, 200 и 204. The connection the `"error"` event is emitted, and the browser won't reconnect. [???]
117117

118118
```smart
119-
There's no way to "reopen" a closed connection. If we'd like to connect again, just create a new `EventSource`.
119+
Переоткрыть закрытое соединение невозможно. Если необходимо снова подключиться, объявите новый `EventSource`.
120120
```
121121

122122
## Message id

0 commit comments

Comments
 (0)