Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
me.now = everyone.now,
me.nowjs = nowjs;
var parseCookie = require("connect").utils.parseCookie;
nowjs.server.set("authorization", function (data, accept) {
if (data.headers.cookie) {
data.cookie = parseCookie(data.headers.cookie);
data.sessionID = data.cookie[me.sessionConfig.key];
} else {
return accept("No cookie transmitted.", false);
}
accept(null, true);
});
nowjs.server.sockets.on('connection', function (socket) {
if(me.connectedUsers.containsKey(socket.handshake.sessionID)) {
me.connectedUsers.removeAtKey(socket.handshake.sessionID);
}
me.connectedUsers.add(socket.handshake.sessionID, {
clientId: socket.id,
sessionId: socket.handshake.sessionID,
userId: null
});
console.log('SessionID ' + socket.handshake.sessionID + ' on ' +
socket.id + ' connected!');
});
nowjs.on("connect", function() {
console.log("now connected: " + this.user.clientId);
launchNow: function() {
var me = this;
me.connectedUsers = Ext.create("Ext.util.MixedCollection");
var nowjs = require("now"),
everyone = nowjs.initialize(me.server);
me.now = everyone.now,
me.nowjs = nowjs;
var parseCookie = require("connect").utils.parseCookie;
nowjs.server.set("authorization", function (data, accept) {
if (data.headers.cookie) {
data.cookie = parseCookie(data.headers.cookie);
data.sessionID = data.cookie[me.sessionConfig.key];
} else {
return accept("No cookie transmitted.", false);
}
accept(null, true);
});
nowjs.server.sockets.on('connection', function (socket) {
if(me.connectedUsers.containsKey(socket.handshake.sessionID)) {
me.connectedUsers.removeAtKey(socket.handshake.sessionID);
}
me.connectedUsers.add(socket.handshake.sessionID, {
clientId: socket.id,