From 9b84f4c9acb700ab6dcf651167c4a6207a78c812 Mon Sep 17 00:00:00 2001 From: UnicodingUnicorn <7555ic@gmail.com> Date: Wed, 3 Apr 2019 09:03:20 +0800 Subject: [PATCH] Fixed nested map not being created --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index 0f7504f..f9170f3 100644 --- a/main.go +++ b/main.go @@ -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