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

查看:1825
本文介绍了来自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套接字链接我使用了智能手机的cordova应用程序。 Firefox也有一个套接字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天全站免登陆