0
I created a very simple server socket with Nodejs (V8.11.3) and it is working OK apparently. My goal is to keep an open socket connection continuously with an electronic device (Iot).
QUESTION: How to make communication secure, i.e., how to make a socket SSL/TLS communication with socket? OBS.: I also created a self-signed certificate for testing.
The test socket server (without security) is this below. As I have no experience with Nodejs I imagine there are much better ways...
const net = require('net')
net.createServer(socket => {
socket.on('error', (err) => {
console.log('Socket Error: ')
console.log(err.stack)
})
socket.on('data', function(data){
msg = ''
msg = data.toString();
socket.write(msg)
console.log(msg)
})
}).listen(8001)