I'm trying to create a dynamically created room for my websocket server. My file server needs to tell the client info about the file they uploaded, like processing progress and stuff like that. This is my view:
export function myView(req, res) {
let file = req.file;
let socketpath = ('/sockets/' + socketid + '/') // A randomly generated id
let wss = new WebSocketServer({port: 3030, path: socketpath});
...
}
This works but only once. As soon as I try sending another file to the server, I get this error:
Error: listen EADDRINUSE 0.0.0.0:3030
at Object.exports._errnoException (util.js:873:11)
at exports._exceptionWithHostPort (util.js:896:20)
at Server._listen2 (net.js:1250:14)
at listen (net.js:1286:10)
at net.js:1395:9
at nextTickCallbackWith3Args (node.js:453:9)
at process._tickDomainCallback (node.js:400:17)
Obviously this is because I'm creating another wss at the same port. But I need a room for each client session upload, how do I make that?
Edit: I did google this, but didn't find anything.