From 36b69047cd59a063c54495cdca06b168572175d3 Mon Sep 17 00:00:00 2001 From: anonpenguin23 Date: Mon, 27 Oct 2025 10:20:35 +0200 Subject: [PATCH] updated makefile --- pkg/gateway/pubsub_handlers.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/gateway/pubsub_handlers.go b/pkg/gateway/pubsub_handlers.go index 3f2f25f..fee1d43 100644 --- a/pkg/gateway/pubsub_handlers.go +++ b/pkg/gateway/pubsub_handlers.go @@ -146,6 +146,17 @@ func (g *Gateway) pubsubWebsocketHandler(w http.ResponseWriter, r *http.Request) if mt != websocket.TextMessage && mt != websocket.BinaryMessage { continue } + + // Filter out WebSocket heartbeat messages + // Don't publish them to the topic + var msg map[string]interface{} + if err := json.Unmarshal(data, &msg); err == nil { + if msgType, ok := msg["type"].(string); ok && msgType == "ping" { + g.logger.ComponentInfo("gateway", "pubsub ws: filtering out heartbeat ping") + continue + } + } + if err := g.client.PubSub().Publish(ctx, topic, data); err != nil { // Best-effort notify client _ = conn.WriteMessage(websocket.TextMessage, []byte("publish_error"))