summaryrefslogtreecommitdiffstats
path: root/api/websocket.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2017-02-14 17:25:40 -0500
committerJoram Wilander <jwawilander@gmail.com>2017-02-14 17:25:40 -0500
commit2e0cf56e86656e791e20fb31566881e8fb748649 (patch)
treeeafcd53a66f7cc15eb9e207766d0446e8ed37b81 /api/websocket.go
parentb86e0daf83c8b7d42f06dcc975542c28fe9ecc69 (diff)
downloadchat-2e0cf56e86656e791e20fb31566881e8fb748649.tar.gz
chat-2e0cf56e86656e791e20fb31566881e8fb748649.tar.bz2
chat-2e0cf56e86656e791e20fb31566881e8fb748649.zip
Fixing websocket auth then sending challenge (#5406)
Diffstat (limited to 'api/websocket.go')
-rw-r--r--api/websocket.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/api/websocket.go b/api/websocket.go
index 5f390395d..5c0858910 100644
--- a/api/websocket.go
+++ b/api/websocket.go
@@ -34,7 +34,11 @@ func connect(c *Context, w http.ResponseWriter, r *http.Request) {
}
wc := app.NewWebConn(ws, c.Session, c.T, c.Locale)
- app.HubRegister(wc)
+
+ if len(c.Session.UserId) > 0 {
+ app.HubRegister(wc)
+ }
+
go wc.WritePump()
wc.ReadPump()
}