fix: fan out unread presence to online sessions
This commit is contained in:
+17
-5
@@ -451,7 +451,7 @@ func (t *Topic) presSubsOffline(what string, params *presParams,
|
||||
target = ""
|
||||
}
|
||||
|
||||
globals.hub.routeSrv <- &ServerComMessage{
|
||||
msg := &ServerComMessage{
|
||||
TenantID: t.tenantID,
|
||||
Pres: &MsgServerPres{
|
||||
Topic: "me",
|
||||
@@ -471,6 +471,7 @@ func (t *Topic) presSubsOffline(what string, params *presParams,
|
||||
RcptTo: user,
|
||||
SkipSid: skipSid,
|
||||
}
|
||||
routeUserServerMessage(uid, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +486,7 @@ func (t *Topic) infoSubsOffline(from types.Uid, what string, seq int64, skipSid
|
||||
continue
|
||||
}
|
||||
|
||||
globals.hub.routeSrv <- &ServerComMessage{
|
||||
msg := &ServerComMessage{
|
||||
TenantID: t.tenantID,
|
||||
Info: &MsgServerInfo{
|
||||
Topic: "me",
|
||||
@@ -498,6 +499,7 @@ func (t *Topic) infoSubsOffline(from types.Uid, what string, seq int64, skipSid
|
||||
RcptTo: uid.UserId(),
|
||||
SkipSid: skipSid,
|
||||
}
|
||||
routeUserServerMessage(uid, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,7 +532,7 @@ func (t *Topic) infoCallSubsOffline(from string, target types.Uid, event string,
|
||||
if offlineOnly {
|
||||
msg.Info.SkipTopic = t.name
|
||||
}
|
||||
globals.hub.routeSrv <- msg
|
||||
routeUserServerMessage(target, msg)
|
||||
}
|
||||
|
||||
// Same as presSubsOffline, but the topic has not been loaded/initialized first: offline topic, offline subscribers
|
||||
@@ -604,7 +606,7 @@ func (t *Topic) presSingleUserOffline(uid types.Uid, mode types.AccessMode,
|
||||
target = ""
|
||||
}
|
||||
|
||||
globals.hub.routeSrv <- &ServerComMessage{
|
||||
msg := &ServerComMessage{
|
||||
TenantID: t.tenantID,
|
||||
Pres: &MsgServerPres{
|
||||
Topic: "me",
|
||||
@@ -622,6 +624,7 @@ func (t *Topic) presSingleUserOffline(uid types.Uid, mode types.AccessMode,
|
||||
RcptTo: user,
|
||||
SkipSid: skipSid,
|
||||
}
|
||||
routeUserServerMessage(uid, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,7 +642,7 @@ func presSingleUserOfflineOffline(tenantID types.TenantID, uid types.Uid, origin
|
||||
target = ""
|
||||
}
|
||||
|
||||
globals.hub.routeSrv <- &ServerComMessage{
|
||||
msg := &ServerComMessage{
|
||||
TenantID: tenantID,
|
||||
Pres: &MsgServerPres{
|
||||
Topic: "me",
|
||||
@@ -654,6 +657,15 @@ func presSingleUserOfflineOffline(tenantID types.TenantID, uid types.Uid, origin
|
||||
RcptTo: uid.UserId(),
|
||||
SkipSid: skipSid,
|
||||
}
|
||||
routeUserServerMessage(uid, msg)
|
||||
}
|
||||
|
||||
func routeUserServerMessage(uid types.Uid, msg *ServerComMessage) {
|
||||
if msg == nil || uid.IsZero() {
|
||||
return
|
||||
}
|
||||
globals.hub.routeSrv <- msg
|
||||
publishRealtimeUserMessage(uid, msg)
|
||||
}
|
||||
|
||||
// Let other sessions of a given user know what messages are now received/read.
|
||||
|
||||
Reference in New Issue
Block a user