Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I have a Nuxt 3 application with socket.io running on DigitalOcean app platform where the client can’t connect to the web socket server.
The web socket runs on the same port 3000 as the application, with:
import startSocketServer from "./server/sockets"
export default defineNuxtConfig({
...
hooks: {
listen: (nuxtServer) => startSocketServer(nuxtServer)
},
...
});
import { Server } from "socket.io";
export default (nuxtServer) => {
const io = new Server(nuxtServer)
io.on("connection", (socket) => {
console.log(`connection ${socket.id}`)
});
};
And on the client I have:
const socketDomain = (isLocal) ? 'localhost:3000' : 'my.domain.com'
const socket = io(socketDomain, {
transports: ['websocket'],
socket.on("connect", () => {
console.log('connect')
});
socket.on("connect_error", (err) => {
console.log(`connect_error due to ${err}`);
});
The application run perfectly locally with nuxi dev or nuxi build && node .output/server/index.mjs but when I deploy on DigitalOcean I get the following:
WebSocket connection to 'wss://my.domain.com/socket.io/?EIO=4&transport=websocket' failed:
doOpen @ entry.3f5d167e.js:21
open @ entry.3f5d167e.js:20
open @ entry.3f5d167e.js:21
$i @ entry.3f5d167e.js:21
A1.exports @ entry.3f5d167e.js:21
open @ entry.3f5d167e.js:21
(anonymous) @ entry.3f5d167e.js:21
invoice.22658294.js:1 connect_error due to Error: websocket error
I also tried with the web socket on a different port, but from my understanding it is not supported on DO.
I also tried with transports: ['polling', 'websocket'] but I got xhr poll error.
What could be the issue?
a6309a057c3f4cb38fb2e7feb67236
KFSys
Thomas M
ef1ed44cc2154be3bcbb2d727878f8
Devs Neonetworks
1e6b823ea20d4cb189a34a922f5588
Telmo Valverde
erik-jan martens
Henry Mui
anthonycarreon
garantieheld
Marin