Passed
Push — master ( f55dd4...6ac744 )
by Mohammad
13:39 queued 20s
created

WebSocketService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Shamaseen\Laravel\Ratchet\Commands;
4
5
use Shamaseen\Laravel\Ratchet\Receiver;
6
use Illuminate\Console\Command;
7
use Ratchet\Http\HttpServer;
8
use Ratchet\Server\IoServer;
9
use Ratchet\WebSocket\WsServer;
10
11
12
/**
13
 * Class ChatService
14
 * @package App\Console\Commands
15
 */
16
class WebSocketService extends Command
17
{
18
    /**
19
     * The name and signature of the console command.
20
     *
21
     * @var string
22
     */
23
    protected $signature = 'run:websocket';
24
25
    /**
26
     * The console command description.
27
     *
28
     * @var string
29
     */
30
    protected $description = 'start websocket';
31
32
    /**
33
     * Create a new command instance.
34
     *
35
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

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.

Loading history...
36
     */
37
    public function __construct()
38
    {
39
        parent::__construct();
40
    }
41
42
    /**
43
     * Execute the console command.
44
     *
45
     * @return mixed
46
     */
47
    public function handle()
48
    {
49
50
        $server = IoServer::factory(
51
            new HttpServer(
52
                new WsServer(
53
                    new Receiver()
54
                )
55
            ),
56
            env('CHAT_PORT',8080)
57
        );
58
59
        $server->run();
60
    }
61
}
62