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