OxL Справочник OxL
РусскийEnglish

data SseConfig

Settings of SseStream.open.

Example:

oxl✓ проверяется в CI
use std.http { SseConfig }

fn main() io {
  // reconnect by itself, at most 5 failed attempts in a row, 1 s between them until the server says otherwise
  let cfg = SseConfig{ reconnect: true, maxReconnects: 5, retryDefault: 1s }
  print("{cfg.maxReconnects}")
}
Вывод
5
pub(api) data SseConfig

С версии. 1.0.0-beta

Поля

pub(api) timeout: Duration? = none

Bound for connecting and receiving the response head (not for the events).

pub(api) lastEventId: str = ""

Last-Event-ID to send (resume).

pub(api) reconnect: bool = false

Reconnect by itself when the stream ends or breaks (WHATWG): after the retry delay the request is repeated with Last-Event-ID set to the last id seen, and next goes on as if nothing happened. The delay is retryDefault until the server sends a retry: field. Reconnecting stops (next returns none) when the server answers anything but 200 (204 = "do not come back"), after maxReconnects failed attempts in a row (-1 = never), or on close(). next(timeout) still bounds each call, reconnect delays included (D-3999).

pub(api) retryDefault: Duration = 3s

Delay before a reconnect until the server sends a retry: field.

pub(api) maxReconnects: i64 = -1

Failed reconnect attempts in a row before giving up; -1 = never.

pub(api) ca: str = ""

https: file with the certificate authorities to trust.

pub(api) caPem: str = ""

https: trust anchors as PEM text.

pub(api) insecureSkipVerify: bool = false

https: skip certificate verification (tests only).

pub(api) verifyHostname: bool = true

https: check that the certificate names the host.

Определено в: std/http/http.oxl:4738

См. также