mirror of
https://github.com/wisplite/tether.git
synced 2026-05-01 06:22:41 -05:00
messages are being received on both ends now!
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package reactivity
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -56,3 +57,18 @@ func (t *Tracker) GetQuerySubscriptions(queryHash string) []string {
|
||||
}
|
||||
return subscriptionIDs
|
||||
}
|
||||
|
||||
func (t *Tracker) SendMessage(clientID string, message []byte) {
|
||||
t.mu.RLock()
|
||||
defer t.mu.RUnlock()
|
||||
client := t.clients[clientID]
|
||||
if client == nil {
|
||||
slog.Error("Tracker: Client not found", "clientID", clientID)
|
||||
return
|
||||
}
|
||||
select {
|
||||
case client.Send <- message:
|
||||
default:
|
||||
slog.Error("Tracker: Client send channel is full", "clientID", clientID)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user