I am trying to create a OPCUA Client in nw.js with the node-opcua package. I got an error in the client.connect function. It says there is no socket.write function. Since I am using the newest nw.js and therefore node.js 11.6, it should be there, like it is discribed in the API.
I am just using the example client code to connect and logged the socket object to the console. There is in fact no "write"-function. Only a "_write"-function with different parameters is available.
My Test Connect Code (nested into async):
var testConnect = function(cb){
client.connect(endpointUrl, function (err) {
if(err) {
console.log(" cannot connect to endpoint :" , endpointUrl );
} else {
console.log("connected !");
}
cb(err);
});
}
Code that throws the error in node_modules\node-opcua-transport\src\tcp_transport.js:
TCP_transport.prototype._write_chunk = function (message_chunk) {
if (this._socket) {
this.bytesWritten += message_chunk.length;
this.chunkWrittenCount ++;
console.log(this._socket);
this._socket.write(message_chunk); <--- This throws the error
}
};
In result the client never connects and will try it forever or till the maxRetry option value is reached.
Any thoughts?