for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Shamaseen\Laravel\Ratchet\Commands;
use Shamaseen\Laravel\Ratchet\Receiver;
use Illuminate\Console\Command;
use Ratchet\Http\HttpServer;
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
/**
* Class ChatService
* @package App\Console\Commands
*/
class WebSocketService extends Command
{
* The name and signature of the console command.
*
* @var string
protected $signature = 'run:websocket';
* The console command description.
protected $description = 'start websocket';
* Create a new command instance.
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
public function __construct()
parent::__construct();
}
* Execute the console command.
public function handle()
$server = IoServer::factory(
new HttpServer(
new WsServer(
new Receiver()
)
),
env('WEBSOCKET_PORT',9090)
);
$this->info('Websocket is now running at port '.env('WEBSOCKET_PORT',9090));
$server->run();
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.