launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04159
[Merge] lp:~rvb/launchpad/lp-app-longpoll-js into lp:launchpad
The proposal to merge lp:~rvb/launchpad/lp-app-longpoll-js into lp:launchpad has been updated.
Description changed to:
This branches adds the js side for the new lp.app.longpoll package (see lp:~allenap/launchpad/lp-app/longpoll/). The whole machinery is present on every page but it really kicks in (i.e. starts a long polling request) only if LP.cache.longpoll is populated.
Every page view that has registered into the event machinery on the server side will start a long polling request on the client side.
subscribe(an_object, "event_name")
When the event is emitted on the server side:
# Server side.
emit(an_object, "event_name", payload)
... the very same event will be fired as a Javascript event to be dealt with by the page's javascript code:
// Client side.
Y.on("event_name", function(payload) {
// Do something.
});
Additional events are provided as part of the longpoll js machinery:
'lp.app.longpoll.start' will be triggered when/if the long polling request is started.
'lp.app.longpoll.failure' will be triggered each time the long polling request fails to connect or to parse the returned data.
Note that the long polling request will be restarted after one event has been consumed so the number of events is not limited.
To avoid initiating requests too quickly if the server is down or has capacity problems, every failed request will wait for 1 second before attempting to reconnect. After 5 failed attempts, the long polling machinery will wait for 3 minutes before trying to reconnect again. All of this will need to be adjusted as we go along but provides a good start.
For more details, see:
https://code.launchpad.net/~rvb/launchpad/lp-app-longpoll-js/+merge/66936
--
https://code.launchpad.net/~rvb/launchpad/lp-app-longpoll-js/+merge/66936
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/lp-app-longpoll-js into lp:launchpad.
References