Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jeremiassgg's avatar

Laravel websockets on productions serve

Hi, im trying to deploy a laravel websockets:serve on a digital ocean droplet, i've created a command using supervisor to launch the serve but im getting this error

Starting the WebSocket server on port 6001...

   RuntimeException

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

  at /var/www/taller/vendor/react/socket/src/TcpServer.php:172
    168|             \STREAM_SERVER_BIND | \STREAM_SERVER_LISTEN,
    169|             \stream_context_create(array('socket' => $context + array('backlog' => 511)))
    170|         );
    171|         if (false === $this->master) {
  > 172|             throw new \RuntimeException('Failed to listen on "' . $uri . '": ' . $errstr, $errno);
    173|         }
    174|         \stream_set_blocking($this->master, false);
    175|
    176|         $this->resume();

      ^[[2m+17 vendor frames ^[[22m
  18  /var/www/taller/artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

This is the command to executed with supervisor

[program:command-socket]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/taller/artisan websockets:serve
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile =/var/www/taller/worker_socket.log                                
0 likes
5 replies
squibby's avatar

The error has a large clue. ' Failed to listen on "tcp://0.0.0.0:6001": Address already in use

Perhaps something is already running on port 6001? In my experience with this package you cannot have the daemon running on 6001 and setup the nginx listener on the same port.

squibby's avatar

Doesn't work? In what way? Does it still say port 6001 already in use, or does it say 6002 already in use or something else? There are many things it could be such as your nginx conf, the variables set. Also if your variables are cached and make a change will need to bust the cache to update etc etc.

sqfgerh's avatar

The error has a large clue. ' Failed to listen on "tcp://0.0.0.0:6001": Address already in use

Please or to participate in this conversation.