Questions about real-time communication on the web (swoole/websocket)

in the IM system, is it pulled through ajax or obtained through websocket to get chat records, contact lists and message lists?
or is it just real-time communication using websocket protocol in the session, and other scenarios directly use ajax;;

I am so depressed and ask for an answer from the great god


basically cooperate

basic data service ajax, and then continue wb events to handle some business events, such as online and offline, chat content, status change, etc.


focus on requirements, for example: I'm going to develop an office IM, for 10 people. Obviously ajax is better, because it's simple. Only a simple poll can be done, real-time requirements on the frequency is higher, no requirements on the lower, all easy to solve, maintenance is also simple, are familiar with the technology.
for example, if real-time is required and there are a large number of people, then you need to consider websocket, so the performance and experience will be much better


except for real-time chat and chat events (users online and offline, kicking, etc.) use socket, to go to ajax


similar message records, friend list is obtained through ajax, chat using socket


is fine, websocket is definitely better

Menu