I am running a website where user can send in-site message (no instantaneity required) to other user, and the receiver will get a notification about the message.
Now I am using a simple system to implement that, detail below.
Table Message:

id
content
receiver
sender

Table User:

some info
notification
some info

When a User A send message to User B, a record will be add to Message and the B.notification will increase by 1. When B open the message box the notification will decrease to 0.
It's simple but does well.
I wonder how you/company implement message system like that.
No need to care about UE(like confirm which message is read by user), just the struct implement.
Thank a lot :D
I think you will need to read about pub/sub for messaging services. For php, you can use libraries such as redis.
So for e.g, user1 subscribe to topic1, any user which publish to topic1, user1 will be notified, and you can implement what will happen to the user1.
How to implement a message system?