How to describe the database of a multi-person chat

3

It's easy to make a conversation between 2 people, I know that, but is there someone who can cite the example of how to do a group conversation? With an unlimited number of people.

Conversation between 2 people:

TABELA MYSQL

|   De    |     Para      |   Mensagem   |


|  User1  |     User2     |     Olá      |
  

Does anyone have a different idea to add more people to this conversation?

    
asked by anonymous 29.07.2015 / 02:40

1 answer

3

Or so:

Table:
| Channel |  who                   | message |
|  #uno   | [nick1, nick2, nick3]  |   Olá   |

Or:

| sender | receiver                | message |
|  nick1 | [nick2, nick3, nick 4]  |   Olá   |

Or even

| id | Channel | who                  |
|  0 | #uno    | [nick1, nick2, ... ] |
----------------------------------
| sender  | toChannel | message |
|  nick1  | 0         |   Olá   |

The possibilities are literally endless; What you have to worry about is having a list of recipients of the message, and looping "while I did not send it to this, send it, otherwise take it off this list"

    
29.07.2015 / 12:13