首页 > 解决方案 > Laravel websockets error on productions serve

问题描述

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                                

标签: laravelnginxlaravel-websockets

解决方案


推荐阅读