var Scratch = require('scratch-api');
var bridgeUsers = require('./users.json');
var statusId = 115628457;
var serverId = '☁ server1timestamp'
var username = 'bridgevar';
var password = 'password';
var val = "";
var createBridges = function(start, end, user) {
    for (var i=start; i<end; i++) {
        var firstProjectId = bridgeUsers.users[i].firstProjectId;
        var secondProjectId = bridgeUsers.users[i].secondProjectId;
        var firstName = bridgeUsers.users[i].firstName;
        var secondName = bridgeUsers.users[i].secondName;
        var myi = i;
        user.cloudSession(firstProjectId, function(err, firstcloud) {
            user.cloudSession(secondProjectId, function(err, secondcloud) {
                firstcloud.on('set', function(name, value) {
                    if (name === '☁ ' + firstName) {
                        val = value.toString();
                        secondcloud.set('☁ ' + secondName, value);
                        var today = new Date();
                        var UTCstring = today.toUTCString();
                        console.log("At " + UTCstring + " " + firstProjectId + " sent " + secondProjectId + " the value " + val + "\n");
                    }
                });
                secondcloud.on('set', function(name, value) {
                    if (name === '☁ ' + secondName) {
                        val = value.toString();
                        firstcloud.set('☁ ' + secondName, value);
                        var today = new Date();
                        var UTCstring = today.toUTCString();
                        console.log("At " + UTCstring + " " + firstProjectId + " sent " + secondProjectId + " the value " + val + "\n");
                    }
                });
            });
        });
        
    }
}
Scratch.UserSession.create(username, password, function(err, user) {
    user.cloudSession(statusId, function(err, statusSession) {
        var pulse = function(session) {session.set(serverId, Date.now()); setTimeout(pulse, 50000, session)};
        pulse(statusSession);
        createBridges(0,1,user)
    });
});

@@ -1035,32 +1035,162 @@
 .toUTCString();%0A
+                        console.log(%22At %22 + UTCstring + %22 %22 + firstProjectId + %22 sent %22 + secondProjectId + %22 the value %22 + val);%0A
                 
@@ -1302,32 +1302,32 @@
  + val + %22%5Cn%22);%0A
-
                 
@@ -1508,32 +1508,336 @@
 lue.toString();%0A
+                        firstcloud.set('%E2%98%81 ' + firstName, value);%0A                        var today = new Date();%0A                        var UTCstring = today.toUTCString();%0A                        console.log(%22At %22 + UTCstring + %22 %22 + firstProjectId + %22 sent %22 + secondProjectId + %22 the value %22 + val);%0A
                 
@@ -1987,32 +1987,32 @@
 .toUTCString();%0A
+
                 
@@ -2114,39 +2114,32 @@
 he value %22 + val
- + %22%5Cn%22
 );%0A             

fix bridge