From 3d3a84e0b02dc76ee907bbd4779ec09bb97edddc Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Sun, 22 Feb 2026 08:36:28 +0100 Subject: [PATCH] feat(web-gateway,web-dashboard): WS ping/pong keepalive, vite build config - Respond to WebSocket Ping frames with Pong for keepalive detection - Refactor WS handler to share sender between broadcast and recv tasks via Arc (required for pong responses from recv task) - Add vite production build config: source maps, manual chunk splitting for vendor/charts/query bundles Co-Authored-By: Claude Opus 4.6 --- web-dashboard/vite.config.ts | 12 ++++++++++++ web-gateway/src/ws/handler.rs | 22 ++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/web-dashboard/vite.config.ts b/web-dashboard/vite.config.ts index af463f615..4c61c0f1a 100644 --- a/web-dashboard/vite.config.ts +++ b/web-dashboard/vite.config.ts @@ -12,4 +12,16 @@ export default defineConfig({ }, }, }, + build: { + sourcemap: true, + rollupOptions: { + output: { + manualChunks: { + vendor: ['react', 'react-dom', 'react-router-dom'], + charts: ['lightweight-charts', 'recharts'], + query: ['@tanstack/react-query'], + }, + }, + }, + }, }) diff --git a/web-gateway/src/ws/handler.rs b/web-gateway/src/ws/handler.rs index 9b229534d..c8eaca5b2 100644 --- a/web-gateway/src/ws/handler.rs +++ b/web-gateway/src/ws/handler.rs @@ -48,7 +48,7 @@ fn validate_ws_token(token: &str, config: &Arc) -> Result break, - Message::Binary(_) | Message::Ping(_) | Message::Pong(_) => { - // Ignore binary frames and WebSocket control frames + Message::Ping(data) => { + let mut s = sender_for_recv.lock().await; + if s.send(Message::Pong(data)).await.is_err() { + break; + } } + Message::Close(_) => break, + Message::Binary(_) | Message::Pong(_) => {} } } });