feat(websocket): handle ping messages sent from react and add logging (#346)

This commit is contained in:
Aveline
2025-04-10 15:10:22 +02:00
committed by Siyuan Miao
parent 9c758b6d57
commit 66a3352e5d
4 changed files with 46 additions and 15 deletions

View File

@@ -275,6 +275,10 @@ func runWebsocketClient() error {
defer cancelDial()
c, _, err := websocket.Dial(dialCtx, wsURL.String(), &websocket.DialOptions{
HTTPHeader: header,
OnPingReceived: func(ctx context.Context, payload []byte) bool {
websocketLogger.Infof("ping frame received: %v, source: %s, sourceType: cloud", payload, wsURL.Host)
return true
},
})
if err != nil {
return err