2019-11-06 08:25:55 +00:00
|
|
|
<?php
|
|
|
|
|
|
2020-09-10 19:59:26 +00:00
|
|
|
namespace BeyondCode\LaravelWebSockets\Console\Commands;
|
2019-11-06 08:25:55 +00:00
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
|
use Illuminate\Support\InteractsWithTime;
|
|
|
|
|
|
2020-09-10 19:59:26 +00:00
|
|
|
class RestartServer extends Command
|
2019-11-06 08:25:55 +00:00
|
|
|
{
|
|
|
|
|
use InteractsWithTime;
|
|
|
|
|
|
2020-08-18 17:21:22 +00:00
|
|
|
/**
|
|
|
|
|
* The name and signature of the console command.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2019-11-06 08:25:55 +00:00
|
|
|
protected $signature = 'websockets:restart';
|
|
|
|
|
|
2020-08-18 17:21:22 +00:00
|
|
|
/**
|
|
|
|
|
* The console command description.
|
|
|
|
|
*
|
|
|
|
|
* @var string|null
|
|
|
|
|
*/
|
2020-09-10 19:59:26 +00:00
|
|
|
protected $description = 'Signal the WebSockets server to restart.';
|
2019-11-06 08:25:55 +00:00
|
|
|
|
2020-08-18 17:21:22 +00:00
|
|
|
/**
|
|
|
|
|
* Run the command.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2019-11-06 08:25:55 +00:00
|
|
|
public function handle()
|
|
|
|
|
{
|
2020-09-10 19:59:26 +00:00
|
|
|
Cache::forever(
|
|
|
|
|
'beyondcode:websockets:restart',
|
|
|
|
|
$this->currentTime()
|
|
|
|
|
);
|
2019-11-06 08:25:55 +00:00
|
|
|
|
2020-09-10 19:59:26 +00:00
|
|
|
$this->info(
|
|
|
|
|
'Broadcasted the restart signal to the WebSocket server!'
|
|
|
|
|
);
|
2019-11-06 08:25:55 +00:00
|
|
|
}
|
|
|
|
|
}
|