You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(core): add opt-in periodic ping for connection health monitoring
Implements the missing periodic ping functionality specified in issue #1000.
Per the MCP specification, implementations SHOULD periodically issue pings
to detect connection health, with configurable frequency.
Changes:
- Add `pingIntervalMs` option to `ProtocolOptions` (disabled by default)
- Implement `startPeriodicPing()` and `stopPeriodicPing()` in Protocol
- Client starts periodic ping after successful initialization
- Server starts periodic ping after receiving initialized notification
- Timer uses `unref()` so it does not prevent clean process exit
- Ping failures are reported via `onerror` without stopping the timer
- Timer is automatically cleaned up on close or unexpected disconnect
Fixes#1000
Co-authored-by: Br1an67 <932039080@qq.com>
0 commit comments