Skip to content

Commit 29886b5

Browse files
committed
fix: default ping interval in secs
1 parent 37d5533 commit 29886b5

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/lib/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { PingConfig } from './types'
88
// Connection constants
99
export const REASON_AUTH_NEEDED = 'authentication-needed'
1010
export const REASON_TRANSPORT_FALLBACK = 'falling-back-to-alternate-transport'
11-
export const PING_INTERVAL_DEFAULT = 30000
11+
export const PING_INTERVAL_DEFAULT = 30 // seconds
1212

1313
// Transport strategy types
1414
export type TransportStrategy = 'sse-only' | 'http-only' | 'sse-first' | 'http-first'
@@ -97,7 +97,7 @@ export function setupPing(transport: Transport, config: PingConfig): () => void
9797
let pingTimeout: NodeJS.Timeout | null = null
9898
let lastPingId = 0
9999

100-
const interval = config.interval * 1000 // convert ms to s
100+
const interval = config.interval * 1000 // convert s to ms
101101
const pingInterval = setInterval(async () => {
102102
const pingId = ++lastPingId
103103
try {
@@ -113,6 +113,7 @@ export function setupPing(transport: Transport, config: PingConfig): () => void
113113
}
114114
}, interval)
115115

116+
log(`Automatic ping enabled with ${config.interval} second interval`)
116117
return () => {
117118
if (pingTimeout) {
118119
clearTimeout(pingTimeout)

src/proxy.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ async function runProxy(
9494
// Start the local STDIO server
9595
await localTransport.start()
9696
log('Local STDIO server running')
97-
if (pingConfig.enabled) {
98-
log(`Automatic ping enabled with ${pingConfig.interval} second interval`)
99-
}
10097
log(`Proxy established successfully between local STDIO and remote ${remoteTransport.constructor.name}`)
10198
log('Press Ctrl+C to exit')
10299

0 commit comments

Comments
 (0)