This is what I've got so far, and I'm trying to find a solution so that:
- The connection is always kept alive, so I can handle status updates
- I can send a websocket message to a client with data from the POST request
ws api here
router.post('/', function (req, res) {
// Need to send ws.send() with post data
})
wss.on('connection', function(ws) {
ws.on('message', function(message) {
console.log('r : %s', message);
});
// ws is only defined under this callback as an object of type ws
});