Answer the question
In order to leave comments, you need to log in
Websocket and data processing?
Good afternoon!
I'm learning how to work with websockets and I'm a little confused.
Let's say there is a remote websocket server (not mine). I connect to it immediately from the page and get data in real time.
If I need to process them, then I need to do it on the server. Accordingly, we need a server that will also receive a remote socket in real time and send data to the page.
Do I understand correctly that the procedure is as follows?:
On the server:
- connect to a remote socket and receive data
- process data
- create your own server socket to which to transfer the processed data
On the client:
- on the page connect to your socket server.
In this form, I am confused by data processing. After all, there may be delays. Let's say when new data is received, and the previous ones have not yet been processed.
Answer the question
In order to leave comments, you need to log in
If your client simply sends data to the server and does not wait for any events initiated by this server, then it is enough to send data with a normal AJAX request.
If the data is being processed for a very long time and you are afraid that data overlay will occur, then in the script that processes the client request, put this data in a queue and process it with another script.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question