1

For example Zendesk has a feature called Agent Collision Notification - when you edit a ticket you get a note if somebody else its editing this ticket.

What is the Infrastructure to support a feature like this? This question seems to aim at the same thing but at a much lower level.

For the system to be completely dynamic (also notifying the first viewer) and reasonable fast, probably some comet or websocket like stuff is needed. But unlike in chat systems (a prime comet example) in a Ticket system users are constantly switching pages.

What would be the program flow and the server infrastructure for a thing like this?

Community
  • 1
  • 1
max
  • 29,122
  • 12
  • 52
  • 79
  • How you implement this at the client side (comet, websockets, AJAX etc) is up to you, but the root of the system is usually based on having either one or two extra columns in the table that holds the record you want to implement this on. This sort of thing is normally referred to as "record locking". You either have a boolean "locked" column on the record (simple) or two columns, "lockwho" which holds the user reference who owns the record, and "lockwhen" which holds a timestamp, to allow you to unlock expired locks (complex). When generating lock messages, just check these column(s). – DaveRandom Jan 15 '12 at 17:44
  • Thanks for the pointer. But I was more thinking about the line of an informal warning not locking. For locking we use a timestamp and optimistic locking. – max Jan 16 '12 at 22:09

1 Answers1

4

If you want to allow realtime collaboration then this question that also mentions Operational Transforms will be of interest to you. And there's also a question about operational transformation libraries.

What would be the program flow and the server infrastructure for a thing like this?

I work for Pusher so I can tell you one solution using our technology.

  1. User A opens page where there could be a 'collision'. Within the page subscribe to a channel for the page.
  2. User A starts editing the page. Send an AJAX request to the server so there is some persisted state about the fact the page is being edited. Trigger an event on the channel stating that the user is editing the page.
  3. User B opens the page. The page loads and can display the information from the persisted state that the page is being edited.
  4. User A finishes editing and a request is made to the server to update the page state. Trigger an event indicating that nobody is editing the page. This event will be distributed to User B (the updated page can also be distributed via within the event or via an AJAX request when the event is received).
  5. User B now knows he/she can edit the page. They begin editing (see step 2.) and User A is notified that User B is now editing the page.

It would also be quite cool to use presence so you could see who else was viewing the page and to allow the users to discuss changes as they happen.

Community
  • 1
  • 1
leggetter
  • 15,248
  • 1
  • 55
  • 61
  • "Presence" is exactly what Zendesk implements: "Joe and Jim are also viewing this page". Thanks for the pointers. – max Jan 16 '12 at 22:11