Ability to register a hook when a client disappears #9

miyagawa opened this Issue Dec 10, 2009 · 2 comments


None yet

2 participants


Ingy wants to remove events from a dead client from message queue backlog.

While I don't think it's a good app design, being able to register a hook when a client disconnects sounds like a good idea for apps to extend the queue management.


More specifically, I(ngy) want to be able to selectively mark/remove msgs from the queue that have become invalid for some reason. It might be

  1. all msgs from client 123
  2. all msgs before a certain time
  3. all odd numbered msgs

(the first 2 are real needs :)

miyagawa commented Jan 7, 2010

lestrrat bugged me about this as well on the other channel, and I finally grok the use case.

It's like in-app direct messaging, where each user is watching their "inbox" channel, like "inbox-$userid", and all DMs are sent to the listeners queue. The problem is that every time you reconnect to the queue (i.e. browser refresh) you'll see the old events you've already seen, for the length of backlogs.

You can set BacklogLength = 0 to avoid this, but then the messages sent while the user is offline will not be stored.

Of course you can avoid this by saving the direct messages to the database and display them in the connection and use the MQ only for realtime messaging, but i wonder hooks for client disconnect could be used for this thing as well..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment