Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

271
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda