I’m using the SvelteKit IO library for sockets in my SvelteKit application.
My main application, when built, runs on port 4173
. My socket runs on 3001
.
Here’s the SKIO setup code: I can’t change 3001
to 4173
without encountering an error.
skio.setup('http://localhost:3001', {
cors: {
origin: "http://localhost:4173",
credentials: true,
},
}).then(io => {
if (browser)
return;
io.on('connect', socket => {
socket.on('message', (message) => {
if (message.game_stop === true) {
socket.disconnect()
} else {
socket.emit('message', message);
socket.broadcast.emit('message', message);
}
});
});
});
How do I deploy such an app with two ports?