Skip to content

Commit eb655dd

Browse files
committed
fix: add output buffering to terminal connection for race condition
- Buffer WebSocket output when no handlers are registered - Flush buffered output when message handler subscribes - Clear buffer on reconnect to prevent stale data - Add debug warning when sendInput fails due to closed connection
1 parent 9a8a929 commit eb655dd

4 files changed

Lines changed: 344 additions & 202 deletions

File tree

backend/src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const sessions = new Map<string, Session>();
8181

8282
// Connection rate limiting per IP
8383
const connectionAttempts = new Map<string, { count: number; resetAt: number }>();
84-
const MAX_CONNECTIONS_PER_IP = 3;
84+
const MAX_CONNECTIONS_PER_IP = 10; // Increased for dev with HMR
8585
const CONNECTION_WINDOW_MS = 60000; // 1 minute
8686

8787
function getClientIP(req: http.IncomingMessage): string {

src/app/practice/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default function PracticePage() {
9696
onReady={() => setConnected(true)}
9797
onDisconnect={() => setConnected(false)}
9898
onError={setError}
99-
className="h-[500px] rounded-lg overflow-hidden"
99+
className="h-[500px] max-w-4xl rounded-lg overflow-hidden border border-[#3b4261]"
100100
/>
101101

102102
{/* Key Visualizer - Always Visible */}

0 commit comments

Comments
 (0)