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

228
Views
How can I troubleshoot a minimalist web socket connection error?

I am using web sockets to connect to localhost as seen below. I am using native web sockets on the client and express-ws on the server.

This was working fine and stopped for some reason. The only changes I can remember making were formatting using ESLint.

How can I troubleshoot this further. The server is showing no error. The client error gives no useful info.

CLIENT

const socket = new WebSocket('ws://localhost:3000/echo');

socket.addEventListener('error', function(event) {
  console.log('DEBUG: WebSocket error:', event);
});

SERVER

function ws(app) {
  const expressWs = require('express-ws')(app);
  console.log('DEBUG: websocket server up');
  app.ws('/echo', (ws, req) => {
    ws.on('message', (msg) => {
      ws.send(msg);
    });
  }); 
}
module.exports = ws;

CLIENT ERROR:

WebSocket connection to 'ws://localhost:3000/echo' failed: 
about 4 years ago · Santiago Trujillo
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!