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

80
Vistas
Socket.IO 4.x client not receiving events upon connection

Here's the code:

const app = express()
const server = http.createServer(app)
const io = new Server(server, {
  cors: {
    origin: "*",
    methods: ["PUT", "GET", "POST", "DELETE", "OPTIONS"],
  }
})

io.on('connection', socket => socket.emit('message', 'well hello there'))

server.listen(APP_PORT, APP_HOST, () => {
  console.log(`Listening on ${APP_HOST}:${APP_PORT}`)
})

Nothing special on the client side:

const socket = io(url)
...
socket.connect()

When I connect, nothing but "probes" (those 2probe 3probe things) and digits shows up in web debugger.

However if I add some significant delay on server side like this

io.on('connection', socket => setTimeout(() => socket.emit('message', 'well hello there'), 500))

everything "works" - client is now able to receive the message (small timeouts below ~350ms are not working btw).

Why is this happening? Any ideas?

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