| 1 | Protocol between HelpIM3 web application and the chatbot. |
|---|
| 2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 3 | |
|---|
| 4 | Chats between a client and a staffmember takes place in jabber MUC-rooms (Multi User Chat). The |
|---|
| 5 | reason for using MUC-rooms for (mainly) two-person chat sessions is that the persons don't need to |
|---|
| 6 | be in eachothers roster in order to be able to chat. |
|---|
| 7 | |
|---|
| 8 | The main task of the jabber chatbot ("bot") is to create and manage the MUC-rooms on the jabber |
|---|
| 9 | server. The web application ("webapp") is resonpsible for directing staff members and clients to |
|---|
| 10 | these MUC-rooms in order to start a private chat. |
|---|
| 11 | |
|---|
| 12 | The bot and webapp negotiate room allocation and usage the following way: |
|---|
| 13 | |
|---|
| 14 | o Reads configuration file with among other things: |
|---|
| 15 | - Jabber-ID ("JID") |
|---|
| 16 | - Nickname to use |
|---|
| 17 | - Password |
|---|
| 18 | - Jabber resource |
|---|
| 19 | |
|---|
| 20 | o Create a pool of MUC-rooms: |
|---|
| 21 | - Use unique name voor the MUC-rooms |
|---|
| 22 | - Set a (random) password on the MUC-room |
|---|
| 23 | - Make sure the is the owner of the rooms |
|---|
| 24 | - Configures the rooms e.g. max number of chatters, backlog.. |
|---|
| 25 | - Make rooms available to the webapp by writing name-password combinations of the |
|---|
| 26 | rooms into a database table |
|---|
| 27 | |
|---|
| 28 | o When a staffmember is available for chat, the webapp takes a room from the database |
|---|
| 29 | and directs the staffmember to one of the available rooms. |
|---|
| 30 | |
|---|
| 31 | o When the bot sees the first person in a room it will be a staff member. The bot |
|---|
| 32 | changes the status of the room in the database to confirm there is a |
|---|
| 33 | staffmember in it available for chat. |
|---|
| 34 | |
|---|
| 35 | o When the webapp has a client wishing to chat with a staff member, it puts the client |
|---|
| 36 | into one of the rooms where a staffmember is available. |
|---|
| 37 | (FIXME: is there an order of the rooms? E.g. the staffmember who is available for |
|---|
| 38 | the longest time gets the next client to chat with?) |
|---|
| 39 | |
|---|
| 40 | o When the bot sees a second person appear in the room it changes the status of the room |
|---|
| 41 | to reflect that. |
|---|
| 42 | |
|---|
| 43 | o The bot checks the number of active rooms and creates a new room if a certain maximum |
|---|
| 44 | is not yet reached. |
|---|
| 45 | |
|---|
| 46 | o When one of the chatters in a room leaves the room, the bot changes the status to |
|---|
| 47 | reflect that fact. |
|---|
| 48 | |
|---|
| 49 | o When the last chatter leaves the room the bot yet again changes the status of the room |
|---|
| 50 | in the database, and the bot also leaves the room, removing it from the jabber server. |
|---|
| 51 | The closed room stays in the database for history record purposes. |
|---|
| 52 | (FIXME: also record timestamps of statuschanges in the room?) |
|---|
| 53 | |
|---|
| 54 | EOF |
|---|