1 year ago

Websockets Server on Homestead using Laravel Websockets

Posted 1 year ago by nickdavies07

I'm using the beyondcode/laravel-websockets package and I'm trying to start the websockets server on Homestead.

I've SSH'd into Homestead and ran php artisan websockets:serve command to start the server however it keeps throwing back an error saying the address is already in use.

$ php artisan websockets:serve
Starting the WebSocket server on port 6001...

   RuntimeException  : Failed to listen on "tcp://": Address already in use

  at /home/vagrant/code/websockets/vendor/react/socket/src/TcpServer.php:164

A quick check with sudo lsof -i -P -n | grep LISTEN shows the vagrant php service is using the port. How would I change the port for websockets, is it just as simple as changing the port in broadcasting.php and restarting the server?

Please sign in or create an account to participate in this conversation.