How do I continuously check to see if there is an active connection to a specific url and port? I am able to get this initially by going with:
const net = require('net');
const testCon = new net.Socket();
testCon.connect('12.12.123.123:8000', function () {
// connected
});
testCon.on('disconnect', function () {
// not connected
});
I didn't want to wrap it in a setInterval function. That seems hacky to me. There has to be a better way to accomplish this.
via Ryan W.