I know I am overthinking this... but the answer is just not clicking.
I have two servers, one a TCP socket server and the other a SockJS server. I need to combine both of their connection events into one super event:
async.parallel({
tcp: function (done) {
self._tcp = net.createServer(function (sock) {
done(null, sock);
});
},
ws: function (done) {
self._ws = sockjs.createServer(function (sock) {
done(null, sock);
});
}
}, function (err, results) {
// This never gets fired!!!
// But I'd like to do stuff here with both
// socket instances – you know, like piping =)
});
Originally I had the TCP connection nested within the WS connection, but that's proving to be problematic as it requires a rigid connection sequence. What I really need is an event that is fired when both connections have been established and have access to their respective sock
instances. Help jogging the brain would be much appreciated!