Created
July 1, 2010 19:40
-
-
Save kriszyp/460449 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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