Private and Multi user chat - GiInfo/SXP GitHub Wiki

What we had

The users had the opportunity to exchange messages in the current version of SXP. But this was limited to a 2-users chat. This can be troublesome if we are trying to agree on a n-user contract, we would have to chat individually with each one of the parties.

Private and Contrat chat

  • Private Chat

In the previous version of SXP, it is possible for users to create a 2-users chat where everyone can talk and discuss This version is been kept.

  • Contrat Chat

We created the possibility for users to create a n-users chat where everyone can talk and discuss without the need to have individually chats to convey general information.

Besides this, we created the possibility for a given user to start a chat related to a given contract. So each contract has its own specific chat common to all users.

  • How ?

To achieve this we changed the Message Entity and added an uuid to represent a chat. By doing this we upgraded the abstract representation of a message to include a way to represent each conversation whilst maintaining an uuid for each individually message.

Another change was to go from a simple receiver champs to a receivers array. Because we have to actually send each individually message to all the members of a chat, this is the easiest way to do so. All 2-users chats will also have this even though they only contain the current user and the only other member of the chat.

By going so we should be able, in the future, to have a read-receipt in the style of facebook/WhatsApp on a n-users chat as well. We only need to implement a read on the uuid of each message sent.

And because now we have an uuid for each chat the logics on the frontend were simplified. We no longer need to check who is the sender/receiver we only need to group messages around an id.

We created, as well, a new function called findAllById. This function is awfully like findOneById but instead of finding only one it will find all given an array of ids. We created this to retrieve all the user's information in the array of receivers. This can be useful for other areas of the future of the projet as well.

What can still be done

As mentioned a functionality that is missing is the read-receipt/notifications. This can be easily done as we explained above.