fix: default ping interval in secs

This commit is contained in:
justin 2025-05-12 19:47:22 -04:00
parent 9fc56bb7b7
commit 9eba3a0d1d
2 changed files with 3 additions and 5 deletions

View file

@ -14,7 +14,7 @@ import fs from 'fs/promises'
// Connection constants
export const REASON_AUTH_NEEDED = 'authentication-needed'
export const REASON_TRANSPORT_FALLBACK = 'falling-back-to-alternate-transport'
export const PING_INTERVAL_DEFAULT = 30000
export const PING_INTERVAL_DEFAULT = 30 // seconds
// Transport strategy types
export type TransportStrategy = 'sse-only' | 'http-only' | 'sse-first' | 'http-first'
@ -106,7 +106,7 @@ export function setupPing(transport: Transport, config: PingConfig): () => void
let pingTimeout: NodeJS.Timeout | null = null
let lastPingId = 0
const interval = config.interval * 1000 // convert ms to s
const interval = config.interval * 1000 // convert s to ms
const pingInterval = setInterval(async () => {
const pingId = ++lastPingId
try {
@ -122,6 +122,7 @@ export function setupPing(transport: Transport, config: PingConfig): () => void
}
}, interval)
log(`Automatic ping enabled with ${config.interval} second interval`)
return () => {
if (pingTimeout) {
clearTimeout(pingTimeout)

View file

@ -94,9 +94,6 @@ async function runProxy(
// Start the local STDIO server
await localTransport.start()
log('Local STDIO server running')
if (pingConfig.enabled) {
log(`Automatic ping enabled with ${pingConfig.interval} second interval`)
}
log(`Proxy established successfully between local STDIO and remote ${remoteTransport.constructor.name}`)
log('Press Ctrl+C to exit')