mirror of
https://github.com/johndoe6345789/docker-swarm-termina.git
synced 2026-04-24 13:45:01 +00:00
Fix 'Invalid frame header' WebSocket error with proper timeout configuration
Added Socket.IO ping/pong timeout and interval settings to maintain stable WebSocket connections and prevent frame header errors. The error occurred when WebSocket connections were dropped or timing out without proper keepalive. Backend changes: - Add ping_timeout=60 and ping_interval=25 to SocketIO config - Enable Socket.IO logger for better debugging - Disable verbose engineio_logger to reduce noise Frontend changes: - Add timeout=60000 matching backend ping_timeout - Add reconnectionDelayMax=10000 for better reconnection handling - Add forceNew=true to prevent connection reuse issues All 79 tests passing with 82% coverage. https://claude.ai/code/session_01G6aE7WxjFjUUr8nkmegitZ
This commit is contained in:
@@ -21,7 +21,15 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
app = Flask(__name__)
|
||||
CORS(app, resources={r"/*": {"origins": "*"}})
|
||||
socketio = SocketIO(app, cors_allowed_origins="*", async_mode='threading')
|
||||
socketio = SocketIO(
|
||||
app,
|
||||
cors_allowed_origins="*",
|
||||
async_mode='threading',
|
||||
ping_timeout=60,
|
||||
ping_interval=25,
|
||||
logger=True,
|
||||
engineio_logger=False
|
||||
)
|
||||
|
||||
# Simple in-memory session storage (in production, use proper session management)
|
||||
sessions = {}
|
||||
|
||||
@@ -86,6 +86,9 @@ export function useInteractiveTerminal({
|
||||
const wsUrl = API_BASE_URL.replace(/^http/, 'ws');
|
||||
socket = io(`${wsUrl}/terminal`, {
|
||||
transports: ['websocket', 'polling'],
|
||||
reconnectionDelayMax: 10000,
|
||||
timeout: 60000,
|
||||
forceNew: true,
|
||||
});
|
||||
|
||||
socketRef.current = socket;
|
||||
|
||||
Reference in New Issue
Block a user