Commit 53d5a07
committed
Implement find() wait and RECONNECT structure event
find() now waits for the target app to appear instead of failing
immediately. subscribeToStructure fires RECONNECT (2) when an app
reappears after being removed, distinguishing restarts from first-time
appearances.
Changes:
- find() waits indefinitely by default; { timeout: N } limits the wait;
{ timeout: 0 } preserves the old immediate-fail behavior
- find() works without prior root() call (triggers connection internally)
- close() is terminal: sets isClosed flag, rejects pending find() waiters,
prevents reconnection after close
- RECONNECT constant (2) added alongside ADD (1) and REMOVE (0)
- Per-app lifecycle via announceApp/unannounceApp: each app is tracked
independently, fixing the bug where one sibling disconnecting lost
all sibling connections
- Subscription keepalive via inactivityResendInterval field (client
requests server resend values/events after 120s of no changes,
matching C++ client ServicesProtocol::InactivityResendIntervalSec)
- Value dedup via lastServerTimestamp and event dedup via recentEventIds
to handle server replay after reconnection
- Exponential backoff with jitter for reconnection (1s to 30s max)
- Stall detection: force reconnect after 150s of server silence with
active subscriptions (must exceed 120s keepalive interval)
- Direct mode sibling discovery uses server-pushed
eStructureChangeResponse instead of client-side polling
- CDP_FORCE_DIRECT_MODE=1 env var to force direct mode on proxy-capable
servers (for testing)
- Cache key fix: use join('.') instead of toString() for correct
invalidateApp prefix matching on app structure changes
- Remove unused serviceId storage on proxy connections
- Fix instanceId serialization: pass through as-is instead of defaulting
falsy values to 0
- appAddress() helper for DRY server address construction
- README updated with Structure Events section and find() options
- Version bump to 3.0.0 (breaking: find() default changed from
immediate fail to indefinite wait)
CDP-60691 parent ea72cfd commit 53d5a07
4 files changed
Lines changed: 495 additions & 61 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
64 | 98 | | |
65 | 99 | | |
66 | 100 | | |
| |||
325 | 359 | | |
326 | 360 | | |
327 | 361 | | |
328 | | - | |
329 | | - | |
| 362 | + | |
| 363 | + | |
330 | 364 | | |
331 | 365 | | |
332 | 366 | | |
333 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
334 | 371 | | |
335 | 372 | | |
336 | 373 | | |
337 | 374 | | |
338 | 375 | | |
339 | | - | |
| 376 | + | |
340 | 377 | | |
341 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
342 | 381 | | |
343 | | - | |
| 382 | + | |
344 | 383 | | |
345 | | - | |
| 384 | + | |
346 | 385 | | |
347 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
348 | 392 | | |
349 | | - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
350 | 397 | | |
351 | | - | |
352 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
353 | 401 | | |
354 | 402 | | |
355 | 403 | | |
| |||
604 | 652 | | |
605 | 653 | | |
606 | 654 | | |
607 | | - | |
608 | | - | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
609 | 658 | | |
610 | 659 | | |
611 | 660 | | |
| |||
0 commit comments