Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fu.get("/latest_message", function (req, res) {
- var since = parseInt(qs.parse(url.parse(req.url).query).since);
- if(since < latestMessageReceived) // new message since client last requested
- sendLatestMessageToClient(res); // send it straight to them
- else
- messageRequests.push({ callback: sendLatestMessageToClient, res: res }); // queue up the requst
- });
Add Comment
Please, Sign In to add comment