-
Notifications
You must be signed in to change notification settings - Fork 4
Proposals
The idea is propose the use of a local database to keep and send messages explaining their advantages and disadvantages.
Using any kind of database to:
- POD reading keeping messages into the database.
- Also keeping sent messages to load it easiest.
- Create a smart database controller, who is able to reading and writing on the pod.
SOLID isolation, the most difficult part, maybe, of the chat.
- Dealing with database that is easy, familiar and provide a lot of info.
- Making a common chat where the database and handlers will be used as adapters.
- Solving 25MB POD's storage.
- Avoiding server use, that should be established, study its behavior and if the app become too big solving potential storage conflicts.
- Easiest to create first tests, just reading and writing a database.
- Model also used by Whatsapp to storage chats.
- Lot of tutorials available on the internet, becoming the decentralization the most difficult part.
- It isn't a solution, just a delegation.
- Delegation of the storage releasing to the handlers.
- Running slowdown.
- Difficulties to include the database with the programming language.
Some important reasons to discard it:
- Writing twice will be a running problem.
- Inconsistencies using the same account in different computers caused by the database.
- Troubles caused by "downloading" any user their own database.
Save chat with user with this format.
In martinlacorrona.solid.community/private/javierardura.solid.community/chat.json:
{
"webid_sender": "martinlacorrona.solid.community",
"webid_reciever": "javierardura.solid.community",
"lastupdate": "2019-03-04T18:26:50.511Z",
"messages": [
{
"date": "2019-03-04T18:25:43.511Z",
"message": "Hola javi"
},
{
"date": "2019-03-04T18:25:45.511Z",
"message": "Que tal?"
},
{
"date": "2019-03-04T18:27:30.511Z",
"message": "Yo estoy bien, gracias por preguntar."
}
]
}
In javierardura.solid.community/private/martinlacorrona.solid.community/chat.json:
{
"webid_sender": "javierardura.solid.community",
"webid_reciever": "martinlacorrona.solid.community",
"lastupdate": "2019-03-04T18:26:50.511Z",
"messages": [
{
"date": "2019-03-04T18:26:44.511Z",
"message": "Bien"
},
{
"date": "2019-03-04T18:26:50.511Z",
"message": "Y tu?"
}
]
}
When javierardura or martinlacorrona open the chat, the content should be:
[2019-03-04 18:25:43] Martin: Hola javi
[2019-03-04 18:25:45] Martin: Que tal?
[2019-03-04 18:26:44] Javier: Bien
[2019-03-04 18:26:50] Javier: Y tu?
[2019-03-04 18:27:30] Martin: Yo estoy bien, gracias por preguntar.
Design patern: Facade
No longer, we have to allow users to chat in group so I think start thinking how to do that will be a good praxis.
Now, we are saving chats in our folder dechat named as our partner pod name with extension (inrupt, solid). In a group it couln´t be possible.
I'm gonna try to explaint it with an example, let's imagine our team wants a group ES1B:
- The first idea will be create the folder with name ES1B, but for example our friend Marcos has another group with the same name, not a good idea at all, two folders with the same name and distinct content.
- The second idea will be name the folder as the group name (ES1B) adding at the end a time code refering the creation date. In this case it's so difficult having the same person two groups with the same name created in the same milli, but not impossible at all.
- The thrid, and to me the best, create the folder name with the group name, the date of creation and the name of the creator of the group. It's 99'99999999% impossible that the same person creates with the same account the same group with the same name in two different computers/cells. So the name will be ES1B1552935126920samuelcifuentes.solid
We could store in this folder a json file with all the chat members to access it easier and looking for send the messages in the easiest way.