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

270
Views
Socket io not working over https, how to solve that?

I run this node script on my server, I can connect via my localhost copy of my webpage. However, I canon't connect from the copy hosted on my server as it's served over HTTPS. I get the error:

Mixed Content: The page at 'https:// ***** .com' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://***** :5000/socket.io/?EIO=3&transport=polling&t=Npij0pe'. This request has been blocked; the content must be served over HTTPS.

socket.io server side code

const server = require('http').createServer();
const io = require('socket.io')(server);

io.on('connection', function(socket) {
  console.log('Sockete birileri bağlandı');

  socket.on('send-message', function(data) {
    console.log(data);
    io.emit('messages', data);
  })

  socket.on('disconnect', function() {
    console.log('birileri geldi ve gitti')
  })
});


server.listen(5000);

client side:

var socket = io('https://*****:5000');

php controller:

$client = new Client(new Version2X('http://*****:5000'));
        $client->initialize();
        $client->emit('send-message', [
            'sender_id' => $currentUser_company_id,
            'reciver_id' => $user->company_id,
            'messege' => request()->message_text,
            'send_time' => date("H:i")
        ]);
        $client->close();

It's working well on localhost, but it's not over https. How can i solve this error ?

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!