vendredi 30 novembre 2018

Socket.io Connection Timedout

I am making a simple blog in Laravel and I setup a websocket so I will have a realtime changes. I used Docker to make it work. In my local machine, it's all good and work perfectly. However when I deployed it to my server which is AWS EC2 Instance. Seems like socket didn't work. In browser console is look like this

GET http://myblog.com:6001/socket.io/?EIO=3&transport=polling&t=MTbkzBX net::ERR_CONNECTION_T

I checked my port

bootstrap.js

import Echo from 'laravel-echo'

window.io = require('socket.io-client');

if (typeof io !== 'undefined') {
    window.Echo = new Echo({
        broadcaster: 'socket.io',
        host: window.location.hostname + ':6001'
    });
} 

I think it's fine here since it worked in my local machine, just in my server won't work. Is anyone encountered the same problem and solved it? Please help me, thanks!

this is what I run to install the websockets

npm install redis socket.io socket.io-client laravel-echo-server laravel-echo



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire