code: function getCumulativeMessages(timestamp, clientSync) {
      var msgs = [];
      if (lastSync > clientSync) {
          msgs = messages;
      } else {
          var newMsgs = messages.length;
          while (newMsgs > 0 && messages[newMsgs - 1].timestamp > timestamp) {
              newMsgs--;
          }
          for (var i = newMsgs; i < messages.length; i++) {
              msgs.push(messages[i]);
          }
      }
  
      var data = {};
      data.msgs = msgs;
      data.lastSync = lastSync;
  
      return data;
  }
docs: get the requested messages from message storage system