client: ack channel <status> stanzas to stop 50-minute stream recycling
The server delivers channel status updates as <status> stanzas. Without a registered node handler they were dropped unacked, so the server redelivered them on every connect and closed the stream every 50 minutes with <stream:error><ack class="status" .../></stream:error>.
This commit is contained in:
@@ -295,6 +295,7 @@ func NewClient(deviceStore *store.Device, log waLog.Logger) *Client {
|
||||
"chatstate": cli.handleChatState,
|
||||
"presence": cli.handlePresence,
|
||||
"notification": cli.handleNotification,
|
||||
"status": cli.handleStatusUpdate,
|
||||
"success": cli.handleConnectSuccess,
|
||||
"failure": cli.handleConnectFailure,
|
||||
"stream:error": cli.handleStreamError,
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2026 Tulir Asokan
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
package whatsmeow
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
waBinary "go.mau.fi/whatsmeow/binary"
|
||||
)
|
||||
|
||||
// handleStatusUpdate acknowledges <status> stanzas (channel status updates).
|
||||
// The content isn't parsed into events yet, but the stanza must be acked:
|
||||
// otherwise the server redelivers it on every connect and recycles the
|
||||
// connection every 50 minutes with
|
||||
// <stream:error><ack class="status" id="..." type="..."/></stream:error>.
|
||||
func (cli *Client) handleStatusUpdate(ctx context.Context, node *waBinary.Node) {
|
||||
defer cli.maybeDeferredAck(ctx, node)()
|
||||
}
|
||||
Reference in New Issue
Block a user