sample/cf-nodejs-shoutboard/web-express.js
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;
}
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;
}
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 ; }
get the requested messages from message storage system
get the requested messages from message storage system