Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

132
Vistas
SocketIO works on localhost but not over HTTPS

so I'm very new to this Web-Development stuff and I'm currently working on a Tic Tac Toe Multiplayer Game that works perfectly in my local network. Now I bought a Domain for practice and I am stuck on this error:

GET https://backend.MYDOMAIN.games/socket.io/?EIO=4&transport=polling&t=NxFY-hh 404

This is my backend code:

const express = require('express')
const app = express();

const fs = require('fs')
const http = require('http')
const https = require('https');
const { Server } = require('socket.io')
const privateKey  = fs.readFileSync('./nodmod2/key.pem');
const certificate = fs.readFileSync('./nodmod2/cert.pem');

const credentials = {key: privateKey, cert: certificate};

const httpServer = http.createServer(app)
const httpsServer = https.createServer(credentials, app)

const io = new Server(httpsServer);

io.on('connection', (socket) => {
    socket.send("connected.")
})

app.get('/debug2', (req, res) => {
    res.send('Works')
})

httpServer.listen(8080)
console.log("HTTP auf 8080")
httpsServer.listen(3000);
console.log("HTTPS auf 3000")

And this is how I am connecting to it:

const socket = io("https://backend.MYDOMAIN.games/debug2");
socket.on('connect', () => {
    displayID(`Your ID: ${socket.id}`)
})

On localhost:3000, this works fine. But not with my domain. What am I missing?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda