var u = buildURI(uri, {id: params.id, when: "open", transport: "longpolljsonp", callback: "dayoff"});
transport.uri = u;
req = http.get(u)
.on("error", function() {
transport.emit("close");
})
.on("response", function() {
poll([]);
transport.emit("open");
function poll(lastEventIds) {
req = http.get(buildURI(uri, {id: params.id, when: "poll", lastEventIds: lastEventIds.join(",")}))
.on("error", function() {
transport.emit("close");
})
.on("response", function(res) {
var body = "";
res.on("data", function(chunk) {
body += chunk;
});
res.on("end", function() {
if (body) {