Closed Dexus closed 7 years ago
Isn't this exactly what is supposed to happen?
Since you're leaving a room and not totally disconnecting the web-socket connection should still be kept alive.
yeah, I was first thinking that was the bug, but it must a bit deeper in the source. Maybe you can find it if you like to watch into it. Else I will do it later.
Il'l look into it when i get off work.
To fix this bug we need to change only:
https://github.com/go-siris/siris/blob/master/websocket/emitter.go#L47 add this
if e.conn.server.rooms[e.to] == nil {
return nil
}
https://github.com/go-siris/siris/blob/master/websocket/server.go#L304-305
s.rooms[name] = append(s.rooms[name][:i], s.rooms[name][i+1:]...)
https://github.com/go-siris/siris/blob/master/websocket/server.go#L331-332
s.rooms[roomName] = append(s.rooms[roomName][:i], s.rooms[roomName][i+1:]...)
Sorry if I just steal you the fun to look into it 😀
Should be fixed in the latest commit to the devel branch https://github.com/go-siris/siris/commit/c5fd6787fba149bb5e20fb69fc4e8828db866370
https://github.com/go-siris/siris/blob/master/_examples/intermediate/websockets/connectionlist/main.go#L73
Need to be close (
delete(Conn,c)
) the connection, else you get all the message...