summaryrefslogtreecommitdiffstats
path: root/api/web_conn.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-05-17 13:55:51 -0700
committer=Corey Hulen <corey@hulen.com>2016-05-17 13:55:51 -0700
commitac509b114df1c1b4b841eded74fb797805e0162d (patch)
tree1b19050c224c505dd57e2a222d2f4492b4742c62 /api/web_conn.go
parent123bfad69c405b0e78e3031d8064fd7621416867 (diff)
downloadchat-ac509b114df1c1b4b841eded74fb797805e0162d.tar.gz
chat-ac509b114df1c1b4b841eded74fb797805e0162d.tar.bz2
chat-ac509b114df1c1b4b841eded74fb797805e0162d.zip
Fixing websocket connection
Diffstat (limited to 'api/web_conn.go')
-rw-r--r--api/web_conn.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/api/web_conn.go b/api/web_conn.go
index 21b6f5b91..9a6fc29df 100644
--- a/api/web_conn.go
+++ b/api/web_conn.go
@@ -22,19 +22,19 @@ const (
type WebConn struct {
WebSocket *websocket.Conn
Send chan *model.Message
- SessionId string
+ SessionToken string
UserId string
hasPermissionsToChannel map[string]bool
hasPermissionsToTeam map[string]bool
}
-func NewWebConn(ws *websocket.Conn, userId string, sessionId string) *WebConn {
+func NewWebConn(ws *websocket.Conn, userId string, sessionToken string) *WebConn {
go func() {
- achan := Srv.Store.User().UpdateUserAndSessionActivity(userId, sessionId, model.GetMillis())
+ achan := Srv.Store.User().UpdateUserAndSessionActivity(userId, sessionToken, model.GetMillis())
pchan := Srv.Store.User().UpdateLastPingAt(userId, model.GetMillis())
if result := <-achan; result.Err != nil {
- l4g.Error(utils.T("api.web_conn.new_web_conn.last_activity.error"), userId, sessionId, result.Err)
+ l4g.Error(utils.T("api.web_conn.new_web_conn.last_activity.error"), userId, sessionToken, result.Err)
}
if result := <-pchan; result.Err != nil {
@@ -46,7 +46,7 @@ func NewWebConn(ws *websocket.Conn, userId string, sessionId string) *WebConn {
Send: make(chan *model.Message, 64),
WebSocket: ws,
UserId: userId,
- SessionId: sessionId,
+ SessionToken: sessionToken,
hasPermissionsToChannel: make(map[string]bool),
hasPermissionsToTeam: make(map[string]bool),
}
@@ -125,7 +125,7 @@ func (c *WebConn) InvalidateCacheForChannel(channelId string) {
func (c *WebConn) HasPermissionsToTeam(teamId string) bool {
perm, ok := c.hasPermissionsToTeam[teamId]
if !ok {
- session := GetSession(c.SessionId)
+ session := GetSession(c.SessionToken)
if session == nil {
perm = false
c.hasPermissionsToTeam[teamId] = perm