Created
August 26, 2011 16:44
-
-
Save jergason/1173831 to your computer and use it in GitHub Desktop.
Chat server callback stuff
This file contains 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
var storage = { | |
"messages": [], | |
"callbacks": [] | |
}; | |
function await_message(func) { | |
storage.callbacks.push(func); | |
} | |
//inside my Connect route | |
app.get("/whatever", function(req, res, next) { | |
if (!req.query.until) { | |
await_message(function(m) { | |
res.end(JSON.stringify(m)); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment