Using socket.io in a separate process is not possible, as the operating system only allows one process to have a listening server on a specific port. If you want to run socket.io alongside another web server, you can do so by using a proxy like nginx to direct traffic to different servers on different ports.
If you are considering starting "npm start separately," there may be a better way to solve your underlying issue without needing to split the servers into separate processes. It's important to understand the actual problem at hand rather than focusing on a specific solution that may not be the most effective approach.
By properly defining the problem, we can explore alternative solutions such as delaying the start of the socket.io server or configuring the servers to meet certain requirements before allowing connections. This way, we can address the real issue at hand rather than getting caught up in potential XY problems.