Home > Software design >  Socketio not connecting on postman socket connection ui on localhost
Socketio not connecting on postman socket connection ui on localhost

Time:10-20

Could not connect to localhost:3000
17:02:53
Error: Unexpected server response: 404
Handshake Details
Request URL: http://localhost:3000/socket.io/?EIO=3&transport=websocket
Request Method: GET
Status Code: 404 Not Found

My express server listen on 3000 port and socketio http on 443 port, i am able to connect socket by hosting this on ec2 instance and using ec2 ip with port number on postman socket connection ui, but on localhost connection always failed with above error on postman socket beta ui.

CodePudding user response:

async function startServer() {
  const app = express();

  const credentials = {key: key, cert: crt};
  const httpsServer = createServer(credentials,app);
  const io = socketIO(httpsServer);
  
  await require('./loaders').default({ expressApp: app, socketIO: io });

  httpsServer.listen(443);
  app.listen(config.port, err => {
    if (err) {
      Logger.error(err);
      process.exit(1);
      return;
    }
    Logger.info(`
      ################################################
                 
  • Related