[thelist] Notification systems in web apps

Bill Moseley moseley at hank.org
Wed Nov 16 21:58:28 CST 2011

I'm pretty fond of my desktop notifications -- and also with my gmail
desktop notifications.  I'm looking for suggestions and ideas on
messaging/notifications systems in web apps.  Just what you have
implemented and any pitfalls to be aware of.

I have apps that do background processing and want the user to be able to
continue to work during that time.  Sometimes I just want to notify the
user that the task is done and It's not that important that the user sees
the message.  (When I open my laptop after a day away I don't want to see a
notification for every new mail that came in while I was away -- just new
mail while I've got my browser open.)

Other tasks are more important.  I might submit a task and then need to
follow up with some action -- so that kind of notification needs to be a
bit more permanent -- or at least persistent until acted upon.

I could be processing a very large number of messages -- so not really
something I want to store in the database.   Might be better to use
something like AMQP (e.g. RabbitMQ) and have a message queue for every
session (the same user could be logged in on more than one browser, for
example) -- which would need a persistent socket to hold the queue.

Messages that must be acknowledged probably have to be in the database (or
some permanent searchable key/value store).  But an approach there might be
to just continue to send the message until acknowledged.  That is, have
some external process (like cron) continue to feed those messages to
(logged in) users.  (I see a race condition there....)

The overall problem I'm trying to solve is the current tight-coupling in an
application.  A web request generates some backend request and then either
blocks or (ajax) polls waiting for a response, and when the backend request
processing slows down or stalls that cascades up to the web layer and the
problem compounds.  It's the old variation of everyone hitting the Reload
button when the site is slow -- which only slows things down more.


Bill Moseley
moseley at hank.org

More information about the thelist mailing list