Should friends' chat messages be processed in the background before being sent, or should the original messages be sent to the front-end for processing?

WBOY
Release: 2016-09-19 09:16:24
Original
931 people have browsed it

The title is not clear enough, please explain in detail.
A user needs to receive messages.
One is to determine the status on the server based on the last operation, such as whether the chat window is open, and then send different messages according to the status. For example, if the chat window is open, it will send a chat message, if it is not open, it will send a message prompt.
The other is that the server sends a message, and then after receiving it, user A uses JS to determine whether the window is open and then chooses whether to prompt or display.

I think the first method has a higher degree of control over the information, and the server computer is better than the client computer to ensure the integrity of the information. But if there is an error in obtaining the status, everything will go wrong.
The second way is more convenient to write, but the user experience will not be good, after all, it needs to be logically processed.

The server-side code is written based on wokerman, and it should not be very relevant to this problem.

Or is there any other better way? I hope the seniors will give me some advice. Thank you.

Reply content:

The title is not clear enough, please explain in detail.
A user needs to receive messages.
One is to determine the status on the server based on the last operation, such as whether the chat window is open, and then send different messages according to the status. For example, if the chat window is open, it will send a chat message, if it is not open, it will send a message prompt.
The other is that the server sends a message, and then after receiving it, user A uses JS to determine whether the window is open and then chooses whether to prompt or display.

I think the first method has a higher degree of control over the information, and the server computer is better than the client computer to ensure the integrity of the information. But if there is an error in obtaining the status, everything will go wrong.
The second way is more convenient to write, but the user experience will not be good, after all, it needs to be logically processed.

The server-side code is written based on wokerman, and it should not be very relevant to this problem.

Or is there any other better way? I hope the seniors will give me some advice. Thank you.

Send the original message to the front end for processing. This processing will not affect the user experience

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template