5
0
Fork 0

Fixed nested map not being created

master
UnicodingUnicorn 2019-04-03 09:03:20 +08:00
parent 6de36a5c66
commit 9b84f4c9ac
1 changed files with 3 additions and 0 deletions

View File

@ -84,6 +84,9 @@ func Subscribe(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
recv := make(chan []byte)
chanId := RandomHex()
if connections[userId] == nil {
connections[userId] = make(map[string] chan []byte)
}
connections[userId][chanId] = recv
// Refresh connection periodically