Anyone who managed to integrate socket.io in a google compute engine? what happens is that I'm trying to integrate but the client does not connect
main.blade.php
window.socket = io("{{env('SOCKET_URL')}}:{{env('SOCKET_PORT')}}");
window.channel = "channel.root";
in the env variables ('SOCKET_URL') and tested with everything from the domain, the localhost, the local ip and the internal and external ip of the compute engine.
in env ('SOCKET_PORT') I use port 8181
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var Redis = require('ioredis');
var redis = new Redis();
redis.subscribe('channel.root', function(err, count) {
console.log('Subscribe on test-channel');
});
io.on('connection', function(socket){
console.log('Connection user');
});
redis.on('message', function(channel, message) {
console.log('Message Recieved');
message = JSON.parse(message);
console.log(message);
io.emit(channel + ':' + message.event, message.data);
var data = message.data.order;
var id = data.restaurant_id;
var check = data.order_check;
if(check == 0){
io.emit('channel.' + id + ':' + message.event, message.data);
}
});
http.listen(8181, function(){
console.log('Listening on Port 8181');
});
And he gives me the following error since he can not connect
GET http://backoffice.com:8181/socket.io/?EIO=3&transport=polling&t=LghumLo net::ERR_CONNECTION_REFUSED
Someone knows what the problem may be or how you can solve it.