Replies: 10 comments
-
What do you mean by this:
|
Beta Was this translation helpful? Give feedback.
-
Hello miguel |
Beta Was this translation helpful? Give feedback.
-
Socket.IO does not use XMLHttpRequest. You have to use a Socket.IO client to emit events at the server. |
Beta Was this translation helpful? Give feedback.
-
so it is not possible to get my request with this line in my server code: |
Beta Was this translation helpful? Give feedback.
-
As a matter of fact I am getting an XMLHttpRequest to my localhost from another server and want to update my web page without reloading the page. |
Beta Was this translation helpful? Give feedback.
-
You seem to be confusing Socket.IO with standard HTTP requests. If you want your client to communicate with the server using HTTP requests, then you do not need Socket.IO. If you want to use Socket.IO however, then you have to use the |
Beta Was this translation helpful? Give feedback.
-
Currently I am using Flask with AJAx as below code to get incoming request. but as you see in my script code I must load my script every one second to check for incoming data and shows it on my page dynamically. I want to run the Ajax script whenever the data available to the serveer and not to check the ajax code every one second. So i am wondering is it able to rewrite my code with socket.io to fulfill this goal.
Ajax script:
|
Beta Was this translation helpful? Give feedback.
-
The example code in this repository shows how to send data from the server to the client periodically. A background thread is used for that purpose. |
Beta Was this translation helpful? Give feedback.
-
Yeah. the background thread check every one second whether there is data or not and then send it to my client. So in order to use this concept with socket.io how should I rewrite my code? |
Beta Was this translation helpful? Give feedback.
-
@Elappnano I don't understand your question, sorry. If you already have a background thread, you have to add the emit call in the proper place, as the example application in this repository does. |
Beta Was this translation helpful? Give feedback.
-
Hello
I am using the following code to process incoming request. Although I test the server and client with the random number but when I add get.request the host shows nothing
server code:
client code:
I am new to coding in socket.io so I do not know how to process get request.
Beta Was this translation helpful? Give feedback.
All reactions