Skip to content

Commit 9eba3a0

Browse files
committed
fix: default ping interval in secs
1 parent 9fc56bb commit 9eba3a0

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
@@ -14,7 +14,7 @@ import fs from 'fs/promises'
1414
// Connection constants
1515
export const REASON_AUTH_NEEDED = 'authentication-needed'
1616
export const REASON_TRANSPORT_FALLBACK = 'falling-back-to-alternate-transport'
17-
export const PING_INTERVAL_DEFAULT = 30000
17+
export const PING_INTERVAL_DEFAULT = 30 // seconds
1818

1919
// Transport strategy types
2020
export type TransportStrategy = 'sse-only' | 'http-only' | 'sse-first' | 'http-first'
@@ -106,7 +106,7 @@ export function setupPing(transport: Transport, config: PingConfig): () => void
106106
let pingTimeout: NodeJS.Timeout | null = null
107107
let lastPingId = 0
108108

109-
const interval = config.interval * 1000 // convert ms to s
109+
const interval = config.interval * 1000 // convert s to ms
110110
const pingInterval = setInterval(async () => {
111111
const pingId = ++lastPingId
112112
try {
@@ -122,6 +122,7 @@ export function setupPing(transport: Transport, config: PingConfig): () => void
122122
}
123123
}, interval)
124124

125+
log(`Automatic ping enabled with ${config.interval} second interval`)
125126
return () => {
126127
if (pingTimeout) {
127128
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)