Lift already guarantees this over the lifetime of this comet actor using lastListenerTime,
which is the last version that we know the client saw (based on the last request we got
from it). Though lastListenerTime seems to indicate this is a timestamp, it's actually a
monotonically increasing number. Currently, the version is privately associated with its
respective JsCmd in the deltas variable in CometActor; the only thing that has access
to that information is the delta pruner (since Lift 3.0-M1 I think). The delta pruner is
periodically handed the comet actor (which will reveal the latest confirmed listener time)
and the list of deltas the actor is holding on to.
You could use this to keep your own updated copy of the deltas and then, at CometActor
shutdown time (in localShutdown), check the current lastListenerTime and stash all as-
yet-unacked deltas in the database or something. It's a tad hacky, but doable and piggybacks
on Lift's already-existing functionality for message delivery confirmation.
Notably, keep in mind that you could get into a situation where the message did arrive at
the client, but the connection failed before the client launched its followup request, so you
think certain messages did not arrive when in fact they did.
Also reiterating: if the user stays on the page and the session/CometActor don't expire, Lift's
comet mechanism will take care of re-transmitting missed data during transient connection
loss. You only need your own solution if you're trying to do cross-session remembering of
things that didn't get delivered, which seems like an odd thing to do (since if the session's
lost, you'd just reload the page to its most current state).
Thanks,
Antonio