v2.0.0 - typescript edition
The new version of node-opcua is out. This version offers a extended Typescript support.
- Typescript
import { OPCUAServer } from "node-opcua";
(async function main() {
try {
const server = new OPCUAServer({
});
await server.start();
} catch (err) {
console.log("Error : ", err);
}
})();
- Async/await
All asynchronous api methods can now be used either as await/async method or as callback method.
import { OPCUAClient } from "node-opcua";
import * as async from "async";
(async function main() {
const client = OCPUAClient.create();
await client.connect();
// ...
await client.disconnect();
```
})();
or old callback style
import { OPCUAClient } from "node-opcua";
const client = OCPUAClient.create();
async.series([
function (callback) {
client.connect(callback);
},
function (callback) {
client.disconnect(callback);
}
], (err) {
});
-
Improvements:
- better automatic client reconnection with subscription reconstruction
- better support for continuous points in browse and read in crawler #563
-
breaking changes
This version introduces a small number of breaking changes that will require adjustment in your code.
There are documented here : https://github.com/node-opcua/node-opcua/wiki/2.0.0-breaking-changes