WebSocket4OPC

Enable WebSocket in OPC DA/AE Server with JSON return, first time ever

DCOM was developed more than 2 decades ago, wich was the pillar of classic OPC. Young kids out of school love dynamical languages (JavaScript/Python etc) since they are simple and straightforward. They are reluctunt to get their feet wet on this legacy technology. Luckily with the wide adoption of WebSocket in most popular languages, WebSocket makes it possible to glue dynamical languages and legacy DCOM together.

This revolutionary solution, WebSocket4OPC, brings unparalleled experience to your desktop or mobile device. It utilizes WebSocket as network transportation between quite a few different clients and classic OPC server. Meanwhile it has equipped all required features to make sure OPC data can be accessed through Internet safely and securely. Remember – all these are achieved without using DCOM, period!

Benefits

.No DCOM when connecting to a classic OPC server .Support dynamical languages (JavaScript/Python etc) .Return in standard JSON format .Intuitive and easy-to-remember commands instead of long REST API .No future DCOM vulnerability to worry .Account authentication available .Secure connection available .Native mobile APP made feasible .No tedious thousand-page OPC UA documents to read .No OPC UA certificate configuration handle .No OPC UA firewall configuration .Edge or Gateway deployment ready

Pre-requiste

1. Installation need be done in the same box of classic OPC DA/AE Server 2. WebSocket feature for IIS need be enabled in server box 3. Microsoft VC++ Runtim for X64 required (download here and install)

Installation

Download all files from server folder to a desired one. Launch a command line with administrator privilege and enter to downloaded folder. Run command “install.bat userAccount userPassword” to complete installation. userAccount/userPassword need be replaced with your own Windows account/password and make sure account has administrator privilege.

To verify, launch browser (Chrome/Safari/Edge) and enter URL “http://localhost/OPC/websocket.html

Uninstallation

Run command “uninstall.bat” in command line with administrator privilege from the downloaded folder to uninstall.

Usage

  1. Browse

    “browse” – Show all children tags under top level

    “browse:tagID” – Show all children tags for a specific tag

    “browse:tagID -countsInPagenation -pageNumber” – Show counted children tags in a pagenation for a specific tag. For example there are 10,000 children tags available under a specific tag and command “browse: tagID -2000 -3” will display 2000 children tags from 4000th to 5999th to correspond to page 3

    JSON return [{“n”: “tagName1”, “i”: “tagID1”, “b”: 1}, {“n”: “tagName2”, “i”: “tagID2”, “b”: 0}, …](n – name, i – ID, b – branch)

    When a “browse: Random” command is sent response will be like,

  2. Subscribe DA

    “subscribe: tagID1, tagID2, …” – Add monitored tags to DA server and receive notification when values change

    JOSN return {“DA”:[{“i”: “tagID1”, “v”: “20.308”, “t”: 1643759756000, “q”: 192}, {“i”: “tagID2”, “v”: “4”, “t”: 1643759756230, “q”: 192}, …]}(i – ID, v – value, t – time stamp, q – quality)

    When a “subscribe: Random.Int1” command is sent response will be like,

  3. Unsubscribe DA

    “unsubscribe” – Remove all monitored tags from DA server

    “unsubscribe: tagID1, tagID2, …” – Remove specific monitored tags from DA server

  4. Subscribe AE

    “subscribeAE” – Receive notification on alarms and events

    JOSN return {“AE”:[{“s”:”tagName1″,”m”:”tagName1 Deviation is Low”,”c”:”DEVIATION”,”sc”:”LO”,”t”:1643760803000,”q”:192,”tp”:4,”ec”:2,”st”:200,”a”:1,”at”:””}, {“s”:”tagName2″,”m”:”tagName2 Limit is Normal”,”c”:”PVLEVEL”,”sc”:”HIHI”,”t”:1643760808000,”q”:192,”tp”:4,”ec”:1,”st”:500,”a”:1,”at”:””}]}(s – source, m – message, c – condition, sc – sub condition, t – time stamp, q – quality, tp – type, ec – category, st – severity, a – acknowledgement, at – actor)

    When a “subscribeAE” command is sent response will be like,

  5. Unsubscribe AE

    “unsubscribeAE” – Remove notification on alarms and events

  6. Disconnect

    “disconnect” – Close connection with server

  7. Help

    “help” or “?” – Display all supported commands and usages

Sample code output

Sample codes for different languages (Python/Swift/C#/C++/Java) are available in client folder

Python

Swift

C#

C++

Java

Roadmap

– Read/write feature in DA upon request – HDA feature upon request – Full-fledged open source native client for iOS

GitHub

View Github