summaryrefslogtreecommitdiffstats
path: root/lib/agent/webserver.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-02-23 18:50:31 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-02-23 19:15:02 +0100
commitbefb10519daefcbee85950a4e574678fe4b7f402 (patch)
treeb4f95889cfacbdf9909c3ccd11dc1f0f8bedb417 /lib/agent/webserver.go
parent38e0baedab9da4516cdc97b526392cbc2c7da67e (diff)
Added target and terminal support.v1.1.0
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/agent/webserver.go')
-rw-r--r--lib/agent/webserver.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/agent/webserver.go b/lib/agent/webserver.go
index 2f24c6c..4deb738 100644
--- a/lib/agent/webserver.go
+++ b/lib/agent/webserver.go
@@ -246,13 +246,15 @@ func (s *WebServer) socketHandler(c *gin.Context) {
}
s.sIOServer.On("connection", func(so socketio.Socket) {
- s.Log.Debugf("WS Connected (WSID=%s, SID=%s)", so.Id(), sess.ID)
- s.sessions.UpdateIOSocket(sess.ID, &so)
+ sessID := sess.ID
+
+ s.Log.Debugf("WS Connected (sessID=%s, WS SID=%s)", sessID, so.Id())
+ s.sessions.UpdateIOSocket(sessID, &so)
so.On("disconnection", func() {
- s.Log.Debugf("WS disconnected (WSID=%s, SID=%s)", so.Id(), sess.ID)
- s.events.UnRegister(xaapiv1.EVTAll, sess.ID)
- s.sessions.UpdateIOSocket(sess.ID, nil)
+ s.Log.Debugf("WS disconnected (sessID=%s, WS SID=%s)", sessID, so.Id())
+ s.events.UnRegister(xaapiv1.EVTAll, sessID)
+ s.sessions.UpdateIOSocket(sessID, nil)
})
})