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

238
Views
Client doesn't make connection with the socket.io (nodejs )server, when deployed on cpanel(vps). Error: Unexpected server response: 101

The socket connection works on localhost but didn't work when uploaded on cpanel.

Server side code

const express = require('express');
const app = express()
const http = require('http').createServer(app);
const io = require('socket.io')(http, {'pingInterval': 10000, 'pingTimeout': 10000});
const bodyParser = require('body-parser');
const port = 3000 // i tried a rage of ports but non of them works

app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json({extended: true,limit: '50mb'}));

io.on('connection', (socket) => {
    console.log(socket.id)
    io.emit('message', "hi");
});

app.get("/", (req, res) => {
    res.send("Get method called")
})

app.post("/", (req, res) => {
    res.send("Post method called")
})

http.listen(port, () => console.log("Listening on port: ",port))

(SERVER) Result on postman:

enter image description here

(Localhost) Result on postman:

enter image description here

I don't know what to do, I did try alot of ports but still no success.

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!