last day (15 days later) » 

07:24
0
A: Laravel Websockets with separate servers

Kamlesh Paulas per laravel websockets doc create a subdomain socket.yourapp.tld then create a nginx config like this server { listen 443 ssl; listen [::]:443 ssl; server_name socket.yourapp.tld; # Start the SSL configurations ssl on; ssl_certificate /etc/le...

Thanks for your reply. Can you please share your echo config too? I just setup the subdomain approach, but still can't make it work. Do you run php artisan websockets:serve on the queue worker server? If so, do you add any flags to it?
@senty. added let me know if you have any issue and make sure you restart your service worker as well
Thanks - Do you only run php artisan websockets:serve on the app server or also in the queue worker?
queue worker is req. in websocket to run event i have both setup
I updated the OP and put all my configs. Can you please take a look?
07:24
@senty what error your getting ? and run php artisan server that server from where you want to expose websoket i guess both server connected to same database ?
There is no error. The queued jobs get success, however App doesn't receive any message from worker. Both servers are connected to the same database and they are in the same VPC.
what is you websocket showing in network tab ?
Request URL: wss://socket.domain.com/app/c17017da-f0fe-4ffb-996a-445e35a18c9b?protocol=7&client=js&version=7.0.3&flash=false

Status: 101 Switching Protocols
yeah then websocket is fine
you need to check correct channel is subscribing or not
yeah, the worker server can't send properly
07:33
users.1 channel is subscribed
but it's same env, same code
wo you can send event to that channel to check data is coming or not here
what event is send data to this channel ? check that is working properly or not
users.1 channel
$this->notify() is continuing without any failure but the data doesn't get delivered
broadcast() throws this exception: Illuminate\Broadcasting\BroadcastException: Pusher error:
can you send me screen shot of error
make sure you uncomment this
```php
// App\Providers\BroadcastServiceProvider::class,
```
from /config/app.php
This is perfectly working in local
07:39
try once uncomment
App\Providers\BroadcastServiceProvider::class
and restart queue worker and websocket both
this is uncommented already
App\Providers\BroadcastServiceProvider::class
I use it for auth of channels
does your event implements ShouldBroadcast ?
I setup the same code to 1 server (app & workers) together
in 1 server, everything works
@KamleshPaul yes
then may be
broadcasting.php
here you need to change same as you did in your config
'host' => env('PUSHER_APP_HOST', '127.0.0.1'),
'port' => env('PUSHER_APP_PORT', 6001),
'scheme' => 'http'
these value need to be updated i guess
do you put implicit port or host when calling php artisan websockets:serve?
07:45
no
it is same as artisan websockets:serve
so you call on 6001 too?
php artisan websockets:serve
Starting the WebSocket server on port 6001...
yes
your websocket is fine
do you have same env in all servers?
you event is not working
yes same env

last day (15 days later) »