From 2ba883aff72daa6b89e5433ce91c4bc414d96947 Mon Sep 17 00:00:00 2001 From: viettranx Date: Fri, 27 Mar 2026 20:27:25 +0700 Subject: [PATCH] fix(pairing): broadcast pairing events for SQLite stores, not just PG SetOnRequest was only wired for PGPairingStore via concrete type assertion. Use interface-based assertion so SQLitePairingStore also gets the callback. This fixes desktop app not receiving real-time pairing request notifications. --- cmd/gateway.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/gateway.go b/cmd/gateway.go index 59ca2fb5..e1b35512 100644 --- a/cmd/gateway.go +++ b/cmd/gateway.go @@ -511,7 +511,11 @@ func runGateway() { // Wire pairing event broadcasts to all WS clients. pairingMethods.SetBroadcaster(server.BroadcastEvent) - if ps, ok := pgStores.Pairing.(*pg.PGPairingStore); ok { + // Wire pairing request callback — works for both PG and SQLite stores. + type pairingRequestNotifier interface { + SetOnRequest(func(code, senderID, channel, chatID string)) + } + if ps, ok := pgStores.Pairing.(pairingRequestNotifier); ok { ps.SetOnRequest(func(code, senderID, channel, chatID string) { server.BroadcastEvent(*protocol.NewEvent(protocol.EventDevicePairReq, map[string]any{ "code": code, "sender_id": senderID, "channel": channel, "chat_id": chatID,