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 ?