Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!