Answer the question
In order to leave comments, you need to log in
WebSockets+Ajax or just WebSockets?
I am writing an interactive application based on WebSocket technology. I have already written the part responsible for sending messages, but the question arose about writing user interaction with the site. Simply put, situations when a user does something, and data about it is sent to the server.
Most examples on the Internet form a WebSocket + Ajax bundle, where sockets only send information to users, and Ajax requests are used the other way around, to send requests to the server.
At the same time, the WebSocket technology itself provides for the possibility for the client itself to send messages to the server. Thus, a dilemma arose - you can do it using Ajax, and based on the results of processing the user's request, simply broadcast the results through sockets, or you can [and, it seems to me, rather], work exclusively through sockets.
Please help me choose the right architecture!
Answer the question
In order to leave comments, you need to log in
Most of the examples on the Internet form a WebSocket + Ajax bundle,
As I understand it, it’s unlikely that someone will answer me already, it’s a pity, apparently the question is too specific ... In general, according to the results, my decision was not to fence, it’s not entirely clear why Ajax is separate for WS, but to transfer all the work to WS, where for each service of my resource, there will be a WS-worker. They, in turn, are built on OOP in such a way that they inherit the parent class that passes them the methods for opening the worker, receiving and sending messages + a little on the specifics of the service, understanding where to send this or that user message, etc.
I hope I can help someone. I have already helped myself
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question