Skip to content

Instantly share code, notes, and snippets.

@kriszyp
Created July 1, 2010 19:40
Show Gist options
  • Save kriszyp/460449 to your computer and use it in GitHub Desktop.
Save kriszyp/460449 to your computer and use it in GitHub Desktop.
on the client side:
function monitor(){
dojo.xhr({
method:"POST",
url:"/TestCalls",
headers:{
"Accept":"message/json",
"Content-Type":"message/json"
},
postData: dojo.toJson([{method:"subscribe", subscribe:"hour"}]),
handleAs: "json"
}).addCallback(function(results){
dojo.forEach(results, dojox.data.restListener);
monitor();
});
}
monitor();
in the model file on the server
var hub = require("tunguska/hub");
Model("TestCalls", store, {
"put": function(object){
object.groups.forEach(function(group){
hub.publish("TestCalls/" + group, {event:"put", source:object.id, result: object});
});
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment