I would like to presist the websocket ws client connections on server restart. It seems like the fastest way to do it is using redis. I'm not really sure how I can go about that, since redis doesn't accept objects (i.e. ws clients). How would I store the ws client onto redis?
const wss = new WebSocket.Server({ noServer: true });
server.on('upgrade', function(request, socket, head) {
console.log(request);
wss.handleUpgrade(request, socket, head, function done(ws) {
// Store ws on redis db
ws.emit('connection', ws, request);
});
});
P.S. I can not use socket.io. I can only use webSocket