0

I want to know how can build db structure for chat system - one to one and group. I'm using MySQL.

I'm using Laravel, redis, socket.io

I just create simple chat to understand stack

How I'm working

Client 1 msg -> Laravel save in db and push in redis -> Node redis client listen -> socket.io send to -> Client 2

How it work for group chat not live chat?

2
  • also, post what you tried Commented Mar 27, 2019 at 6:21
  • This is a much too generic question. You will need to do some of the work yourself, and narrow down your question to specifics once you get stuck. Commented Mar 27, 2019 at 13:30

1 Answer 1

1

You can build something like that with minimal columns

chat (one to one)

id | message | message_type | sender | reciever | reply_to (optional) | created_at | updated_at | deleted_at (optional)

chat_messages (group)

id | group_id | message | message_type | sender | reply_to (optional) | created_at | updated_at | deleted_at (optional)

You have to define groups (group_id - relation) if you want to implement

You can prefer the above example only basic functionality is there. you can update based on your logic

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.