Page MenuHomePhabricator

Allow users to receive Aphlict notifications for an object they are viewing
Closed, ResolvedPublic

Description

Currently, Aphlict notifications are broadcast to logged-in users that are (in some way) subscribed to the subject PHID. It would be useful to be able to broadcast notifications to users who are viewing the subject as well. This is slightly more involved than just "users", because a user looking at T123 should receive real-time notifications about it, even if they aren't a subscriber/author/etc.

Generally, this will involve:

  • Updating broadcast messages to include the PHIDs they should be broadcast to (that is, beyond the user PHIDs pertaining to the author and subscribers).
  • Updating the Aphlict client:
    • It now sends "listen to" and "stop listening to" messages to the server.
      • "listen to" is a list of PHIDs the client cares about.
      • "stop listening" is a list of PHIDs the client no longer cares about.
    • When the user visits a page, the browser sends "listen to" for the object PHID on the page (if one exists) and the user PHID (if not already listening).
    • When the user leaves a page, the browser sends "stop listening" (ideally; not a big deal if not).
    • We do some reference counting on the client to keep this not-too-spammy I guess.
  • So the server now knows which PHIDs a message is about, and which clients care about those PHIDs. It can broadcast messages to just the relevant clients, and we don't need to do any auth stuff.

Event Timeline

joshuaspence claimed this task.
joshuaspence raised the priority of this task from to Normal.
joshuaspence updated the task description. (Show Details)
joshuaspence added a project: Aphlict.
joshuaspence added subscribers: joshuaspence, epriestley.

Things left to do here

  • Implement unsubscription.
    • The AphlictClient should unsubscribe (probably implicitly) from all PHIDs when the client is closed.
    • The AphlictMaster should unsubscribe from a given PHID when there are no more clients subscribe to that PHID.
  • Clients need to re-send their subscriptions when a new master is created. I think that all subscriptions will basically be lost at the moment if the master dies or is ended. The clients should probably re-send all of their subscriptions when a new master comes alive.
  • General maintenance and cleaning up.

I'm reasonably satisfied that this is complete now. Feel free to re-open (or file a new ticket) if there is anything clearly missing.

joshuaspence renamed this task from Allow users to receive Aphlict notifications for an object they are viewing. to Allow users to receive Aphlict notifications for an object they are viewing.Jul 10 2014, 7:05 PM