File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ Adaptors bridge the client to actual CRDT state:
197197``` ts
198198new LoroWebsocketClient ({
199199 url: string , // Required ws:// or wss:// endpoint.
200- pingIntervalMs?: number , // Default 30_000 ms.
200+ pingIntervalMs?: number , // Default 20_000 ms.
201201 disablePing?: boolean , // Skip periodic ping/pong entirely.
202202 onWsClose?: () => void , // Invoked on low-level close before status change.
203203});
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ new LoroWebsocketClient(options: LoroWebsocketClientOptions)
6868
6969interface LoroWebsocketClientOptions {
7070 url: string ; // WebSocket URL (ws:// or wss://)
71- pingIntervalMs? : number ; // Periodic ping interval (default 30_000ms )
71+ pingIntervalMs? : number ; // Periodic ping interval (default 20_000ms )
7272 disablePing? : boolean ; // Disable periodic pings entirely
7373 onWsClose? : () => void ; // Low‑level ws close callback (before status transitions)
7474}
@@ -117,7 +117,7 @@ type ClientStatusValue = typeof ClientStatus[keyof typeof ClientStatus];
117117## Latency & Ping/Pong
118118
119119- Periodic pings
120- - By default, the client sends a text ` "ping" ` every 30s (configurable via ` pingIntervalMs ` ) and expects a ` "pong" ` . This keeps the connection alive and measures round‑trip latency.
120+ - By default, the client sends a text ` "ping" ` every 20s (configurable via ` pingIntervalMs ` ) and expects a ` "pong" ` . This keeps the connection alive and measures round‑trip latency.
121121 - Set ` disablePing: true ` to turn off the timer.
122122
123123- On‑demand ping
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ export type ClientStatusValue =
9898export interface LoroWebsocketClientOptions {
9999 /** WebSocket URL (ws:// or wss://). */
100100 url : string ;
101- /** Optional custom ping interval. Defaults to 30s . Set with `disablePing` to stop timers. */
101+ /** Optional custom ping interval. Defaults to 20s . Set with `disablePing` to stop timers. */
102102 pingIntervalMs ?: number ;
103103 /** Ping timeout; after two consecutive misses the client will force-close and reconnect. Defaults to 10s. */
104104 pingTimeoutMs ?: number ;
@@ -1733,15 +1733,15 @@ function isPositive(v: unknown): v is number {
17331733 return typeof v === "number" && isFinite ( v ) && v > 0 ;
17341734}
17351735
1736- // Use default 30s unless disabled
1736+ // Use default 20s unless disabled
17371737function getPingIntervalMs ( opts : {
17381738 pingIntervalMs ?: number ;
17391739 disablePing ?: boolean ;
17401740} ) : number | undefined {
17411741 if ( opts . disablePing ) return undefined ;
17421742 const v = opts . pingIntervalMs ;
17431743 if ( isPositive ( v ) ) return v ;
1744- return 30_000 ;
1744+ return 20_000 ;
17451745}
17461746
17471747function createLoroWebsocketClientRoom ( opts : {
You can’t perform that action at this time.
0 commit comments