Search code examples
javascripttcpwebsocketmodbus

Modbus TCP communication from HTML/Javascript Webpage


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).

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

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

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

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

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.

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

Is this possible?


Solution

  • 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.