mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-13 12:14:40 +00:00
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.
This commit is contained in:
1 parent
0a8ca13d08
commit
2ba883aff7
1 file changed
+5
-1
+5
-1
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user