来自 HTML/Javascript 网页的 Modbus TCP 通信 [英] Modbus TCP communication from HTML/Javascript Webpage

查看:80
本文介绍了来自 HTML/Javascript 网页的 Modbus TCP 通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 Modbus TCP 的设备.我想从中读取数据并将其显示在网页上(没有中间服务器).

I have a device that uses Modbus TCP. I want to read data from it and display it on a webpage (Without an in between server).

我发现了一个与 Chrome 扩展程序几乎完全相同的项目:

I have found a project that does almost this exact same thing as a Chrome extension:

https://github.com/Cloud-Automation/chrome-modbus

它在javascript代码中使用:chrome.sockets.tcp

It uses this in the javascript code: chrome.sockets.tcp

我希望我可以使用 WebSockets 在我的网页上做同样的事情.

I was hoping that I could do the same thing on my webpage using WebSockets.

看来 websockets 可以在我的网页上工作(充当客户端),从设备(充当服务器)发送和接收信息.貌似websockets没有受到cors的影响.

It seems that websockets would work on my webpage (acting as the client), sending and receiving information from the device (acting as the server). It doesn't seem that websockets is affected by cors.

有没有人指出我可以从哪里开始?(或者一个 javascript 库会很棒)

Does anybody have pointers on where I could start on this? (Or a javascript library would be great)

这可能吗?

推荐答案

我确实在没有服务器的情况下解决了这个问题.我使用 Chrome Sockets link 做到了这一点,我还使用智能手机的cordova应用程序使其工作.Firefox 也有一个 sockets api,但没有尝试为该浏览器找出它.

I did get this solved without a server in between. I did it using Chrome Sockets link I also made it work using a cordova app for smart phones. Firefox has a sockets api as well, but did not attempt to figure it out for that browser.

这篇关于来自 HTML/Javascript 网页的 Modbus TCP 通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆