summaryrefslogtreecommitdiffstats
path: root/api/web_hub.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/web_hub.go')
-rw-r--r--api/web_hub.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/api/web_hub.go b/api/web_hub.go
index db0f31bb7..455189f70 100644
--- a/api/web_hub.go
+++ b/api/web_hub.go
@@ -67,10 +67,23 @@ func (h *Hub) Start() {
h.connections[webCon] = true
case webCon := <-h.unregister:
+ userId := webCon.UserId
if _, ok := h.connections[webCon]; ok {
delete(h.connections, webCon)
close(webCon.Send)
}
+
+ found := false
+ for webCon := range h.connections {
+ if userId == webCon.UserId {
+ found = true
+ break
+ }
+ }
+
+ if !found {
+ go SetStatusOffline(userId)
+ }
case userId := <-h.invalidateUser:
for webCon := range h.connections {
if webCon.UserId == userId {