Joke Collection Website - Public benefit messages - How does java realize the teacher-student interaction of short message in the station?

How does java realize the teacher-student interaction of short message in the station?

Database design, sender id, receiver id, information content, sending time, whether it has been read.

When the student is online, check whether there is any unread message for the recipient. After checking, mark all contents as read.

When the teacher sends a message, the message is unread by default.

It's simple.

If it's real-time information on the web, just brush it with ajax and set a time. It is very simple when there are not many users and the performance requirements are not high.