Skip to content

Commit 5a6b811

Browse files
committed
Fix: invisibility bug
1 parent eae57e6 commit 5a6b811

File tree

1 file changed

+9
-0
lines changed
  • backend/internal/wsserver

1 file changed

+9
-0
lines changed

backend/internal/wsserver/hub.go

+9
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ func MessageUser(client *Client, message []byte){
226226
// notifying that the given user has left the channel
227227
// note: This function will not remove the given user
228228
func BroadcastUserLeft(channel string, client *Client, logger *log.Logger){
229+
//there can be multiple instances of a logged user account connected to a channel.
230+
//in that cause if one instance leaves, the user did not actually leave so
231+
//we will not broadcast the message
232+
for c := range client.hub.clients {
233+
if c.userInfo.Callsign == client.userInfo.Callsign && c != client{
234+
return
235+
}
236+
}
237+
229238
msg := MessageLeave{
230239
Type: "leave",
231240
Channel: channel,

0 commit comments

Comments
 (0)