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
1. Installation need be done in the same box of classic OPC DA/AE Server Pre-requiste
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 need have administrator privilege.
To verify, launch browser (Chrome/Safari/Edge) and enter URL "http://localhost/OPC/websocket.html"
Run command "uninstall.bat" in command line with administrator privilege from the downloaded folder to uninstall. Uninstallation
Usage
-
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,
-
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,
-
Unsubscribe DA
"unsubscribe" - Remove all monitored tags from DA server
"unsubscribe: tagID1, tagID2, ..." - Remove specific monitored tags from DA server
-
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,
-
Unsubscribe AE
"unsubscribeAE" - Remove notification on alarms and events
-
Disconnect
"disconnect" - Close connection with server
-
Help
"help" or "?" - Display all supported commands and usages
Sample codes for different languages (Python/Swift/C#/C++/Java) are available in client folder Sample code output
Python
Swift
C#
C++
Java
- Read/write feature in DA upon request Roadmap
- HDA feature upon request
- Full-fledged open source native client for iOS