Javascript的TCP套接字连接Javascript、TCP

2023-09-11 01:13:38 作者:眉间多许柔意

基本上,我有发送信息的服务器(在这种情况下的温度数据,每一秒)

Basically, I have a server that sends out info (in this case temperature data, every second)

我想要显示的温度和动态更新在网页上,只有JavaScript的。

I want to have the temperature displayed and dynamically updated on a webpage, with only javascript.

我不能更改服务器反正。它似乎很简单,但我无法找到我所需要的。

I cannot change the server in anyway. It seems simple but I couldn't find what I needed.

推荐答案

您需要做的是让用PHP,或其他服务器端的连接,并通过AJAX结果返回到你的JavaScript。

What you need to do is make the connection with PHP, or something else server side, and return the result via AJAX to your JavaScript.

 
精彩推荐
图片推荐