Skip to content

Commit 2a93f9c

Browse files
committed
Translated "Message id"
1 parent 15c9966 commit 2a93f9c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,31 +119,31 @@ eventSource.close();
119119
Переоткрыть закрытое соединение невозможно. Если необходимо снова подключиться, объявите новый `EventSource`.
120120
```
121121

122-
## Message id
122+
## Идентификатор сообщения
123123

124-
When a connection breaks due to network problems, either side can't be sure which messages were received, and which weren't.
124+
Когда соединение прерывается из-за проблем с сетью, ни сервер, ни клиент не могут быть уверены в том, какие сообщения были доставлены, а какие - нет.
125125

126-
To correctly resume the connection, each message should have an `id` field, like this:
126+
Чтобы правильно возобновить подключение, каждое сообщение должно иметь поле `id`:
127127

128128
```
129-
data: Message 1
129+
data: Сообщение 1
130130
id: 1
131131
132-
data: Message 2
132+
data: Сообщение 2
133133
id: 2
134134
135-
data: Message 3
136-
data: of two lines
135+
data: Сообщение 3
136+
data: в две строки
137137
id: 3
138138
```
139139

140-
When a message with `id:` is received, the browser:
140+
Получая сообщение с указанным `id:`, браузер:
141141

142-
- Sets the property `eventSource.lastEventId` to its value.
143-
- Upon reconnection sends the header `Last-Event-ID` with that `id`, so that the server may re-send following messages.
142+
- Установит его значение свойству `eventSource.lastEventId`.
143+
- При переподключении отправит заголовок `Last-Event-ID` с этим `id`, чтобы сервер мог переслать последующие сообщения.
144144

145-
```smart header="Put `id:` after `data:`"
146-
Please note: the `id:` is appended below the message data, to ensure that `lastEventId` is updated after the message data is received.
145+
```smart header="Указывайте `id:` после `data:`"
146+
Обратите внимание: `id` указывается после текста сообщения, чтобы обновление `lastEventId` произошло после того, как данные сообщения были получены.
147147
```
148148
149149
## Connection status: readyState

0 commit comments

Comments
 (0)