Skip to content

Socket Admin Disconnect

Savion edited this page Oct 22, 2018 · 3 revisions

Overview

If an admin disconnects, it will most like be an accident (closed tab, browser crash, etc). In this case, the user will be sent a message that the admin disconnected. The admin will then be given ~1-2 minutes to reconnect. There's 2 possibilities here that I think could work:

  1. In this time, the client code will emit a "user waiting for admin reconnect" event so that when the admin reopens the page, they can easily click a button and get right back into the conversation. The signal will basically create a button on the admin page asking if you were the one that disconnected. The disconnected admin would click it when they rejoin, and all the other admins would just ignore it. The chat will then continue as normal.
  2. Another possibility when the admin disconnects first, is that the user's id who the admin is talking to is stored in LocalStorage, so when the admin reopens the tab, they're auto re-connected to the user by the browser accessing the storage and finding the id. These 2 ways both definitely have their pros and cons. I like the first one because it allows for an admin to reconnect independent of the device, so if their computer dies, they can still access the chat on their phone just the same. The second option is of course a lot more convenient and easy to use, especially if multiple admins disconnect in the same time frame. I think a good solution would be to have a mixture of both. When the admin disconnects first, they're given firstly 30 seconds to reopen the tab, in which case they'd automatically be rejoined into the chat by the browser accessing local storage. If the admin accidentally closed the tab or the browser, they should be able to get back within 30 seconds. After that time, option 1 happens, in which a signal will be emitted to all admins that a user is awaiting an admin reconnect. This will allow the admin that disconnected to rejoin on any other device they want.

If the admin does not come back within the allotted time, the user will be put back into the queue with high priority (front of the list). Preferably, the new admin that accepts the user will get a log of the conversation between the user and the old admin so that the user doesn't need to explain everything again. Or they could start from zero completely. Or maybe the user will even have an option to choose either.

Clone this wiki locally