Added token ID property to incoming socket messages

Clients can send a property called token_id to a socket for user persistency across disconected sockets.

James Peret vor 7 Jahren
Ursprung
Commit
ec42960e5b
2 geänderte Dateien mit 2 neuen Zeilen und 1 gelöschten Zeilen
  1. 1 1
      src/logger.js
  2. 1 0
      src/multi-adapter.coffee

+ 1 - 1
src/logger.js

@@ -34,7 +34,7 @@ var log = function(robot, level, msg, data){
34 34
     for(socket_name in sockets) {
35 35
       if(sockets.hasOwnProperty(socket_name)) {
36 36
           var socket = sockets[socket_name];
37
-          socket.emit('log', { message: msg, data: data})
37
+          socket.emit('log', { message: msg, data: data, level: level})
38 38
       }
39 39
     }
40 40
   }

+ 1 - 0
src/multi-adapter.coffee

@@ -71,6 +71,7 @@ class MultiAdapter extends Adapter
71 71
         #console.log(data.message)
72 72
         user.name = data.username
73 73
         user.service = "socket"
74
+        user.token = data.token
74 75
         @receive new TextMessage user, data.message
75 76
 
76 77
       socket.on 'disconnect', =>