summaryrefslogtreecommitdiffstats
path: root/lib/agent/sessions.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/agent/sessions.go')
-rw-r--r--lib/agent/sessions.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/agent/sessions.go b/lib/agent/sessions.go
index 7347480..3d8b0f4 100644
--- a/lib/agent/sessions.go
+++ b/lib/agent/sessions.go
@@ -125,6 +125,14 @@ func (s *Sessions) Get(c *gin.Context) *ClientSession {
return nil
}
+// GetID returns the session or an empty string
+func (s *Sessions) GetID(c *gin.Context) string {
+ if sess := s.Get(c); sess != nil {
+ return sess.ID
+ }
+ return ""
+}
+
// IOSocketGet Get socketio definition from sid
func (s *Sessions) IOSocketGet(sid string) *socketio.Socket {
s.mutex.Lock()