laravel-websockets icon indicating copy to clipboard operation
laravel-websockets copied to clipboard

Docker no connection

Open matze1708 opened this issue 3 years ago • 8 comments

Hello,

I have Laravel running in a Docker environment with the packages mysql,nginx and php-fpm. I use this as an API. I now want to add the websocket server, this also works, I can start the server via php artisan websocket:serve. Via the statistic laravel-websockets I can connect to the websocket server, I can also see that in the console.

However, I can't connect from my VUE app or from a web socket test client, I can't get a connection.

What do I have to do? How do I get the connection from Docker to my client?

Thank you very much.

matze1708 avatar Jul 19 '21 08:07 matze1708

Does anyone have an idea for my problem?

matze1708 avatar Jul 27 '21 06:07 matze1708

Again as supplemental info, I have a Laravel backend and a separate Vue project. This Vue project is not in the Laravel directories!

matze1708 avatar Jul 27 '21 09:07 matze1708

This highly depends on how your Docker is setup. You'll want to set the PUSHER_ENDPOINT_HOST to the IP of the correct container, not just 127.0.0.1.

calebanthony avatar Jul 28 '21 17:07 calebanthony

Hi thanks for your replay. Where does this variable belong?

matze1708 avatar Jul 28 '21 20:07 matze1708

By the way is it possible to have the server in project A and the FrontEnd in another project, so a pure vue.js project? I still find examples where Laravel and Vue are in one project.

matze1708 avatar Jul 29 '21 06:07 matze1708

This is actually my not working config:

subscribe() { const pusher = new Pusher( 'Tx1f8zribV', { cluster: 'mt1', enabledTransports: ['ws'], PUSHER_ENDPOINT_HOST: 'workspace', host: 'workspace', }, ); Pusher.log = (msg) => { console.log(msg); }; pusher.subscribe('GAUpdate'); pusher.bind('GAUpdate', (data) => { console.log(data); }); }, },

matze1708 avatar Jul 29 '21 12:07 matze1708

Hello,

I have Laravel running in a Docker environment with the packages mysql,nginx and php-fpm. I use this as an API. I now want to add the websocket server, this also works, I can start the server via php artisan websocket:serve. Via the statistic laravel-websockets I can connect to the websocket server, I can also see that in the console.

However, I can't connect from my VUE app or from a web socket test client, I can't get a connection.

What do I have to do? How do I get the connection from Docker to my client?

Thank you very much.

you can specify a port to execute the supervisor that runs the websocket in docker image it works like this for me

daitkhealex avatar Aug 11 '21 05:08 daitkhealex

Hello,

I have Laravel running in a Docker environment with the packages mysql,nginx and php-fpm. I use this as an API. I now want to add the websocket server, this also works, I can start the server via php artisan websocket:serve. Via the statistic laravel-websockets I can connect to the websocket server, I can also see that in the console.

However, I can't connect from my VUE app or from a web socket test client, I can't get a connection.

What do I have to do? How do I get the connection from Docker to my client?

Thank you very much.

I also have Laravel running in a Docker environment with the packages mysql,nginx and php-fpm , but i am struggling in the config of ws in ngnix , can you help me ? websocket is served and everything is running okay , but i can't connect via the statistic laravel-websockets

Mohamed-Ali-Nakouri avatar Oct 13 '21 11:10 Mohamed-Ali-Nakouri