Flotype / now

NowJS makes it easy to build real-time web apps using JavaScript
http://www.nowjs.com
MIT License
1.91k stars 175 forks source link

regarding now variables "auto-synced" #4

Closed blaenk closed 13 years ago

blaenk commented 13 years ago

Hey, this is probably a stupid question, but it seems like this would work wonderfully for what I am trying to do. My only question is, if I store a json object in now, and I only update some of the values in it, is there some mechanism in place to only "send" (if that's even what happens) the changed values, or does it send everything again?

To provide context: I am writing a web interface for a command-line program, communicating through xml-rpc. I would like to have it auto-update data on the pages, and so the closest I could get to this due to the nature of the program is polling. I don't want to do this on the client-side as this would bombard the program (if each client polls at different times). I was thinking of writing a node back-end that would itself poll the command line program on an interval, and then if there were changes to the data, it would push them out.

The 'auto-syncing' feature of the now namespace seemed really interesting for this application.

Basically the command-line app has a list of items each with its own properties, so the retrieved data by the node back-end would look roughly like this:

data = {
    item-1: {
        name: "first",
        progress: "53%"
    },
    item-2: {
        name: "second",
        progress: "67%"
    }
}

Something that might change from one poll interval to the next is item-2's progress, for example.

To repeat my question: If I were to simply re-assign the now.data variable each time with the new hash, is there a mechanism in place so that the client only has to download the changed part (item-2's progress)?

If not, can anyone provide any opinions/suggestions for what I'm trying to do?

I would really appreciate it.

ericz commented 13 years ago

Hi blaenk,

We just realized that the version of NowJS on github does not currently support changing in place. We had implemented the feature in an earlier version.

I am very sorry for the mix up. We are looking into re-integrating the feature and including it in the next release.

Sorry, Eric

blaenk commented 13 years ago

Hey ericz,

It's fine, thanks for giving me a heads up. I hadn't begun doing what I mentioned above yet, I was about to today but thanks for letting me know. I'll wait for the new release with this functionality in it. I would appreciate some notification when that release is available, perhaps here.