Passed
Push — master ( 46e929...f9b884 )
by Arthur
01:35
created

MaxConnectionsBench::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace WSSCTEST\Benchmark;
4
5
require_once __DIR__ . '/../../vendor/autoload.php';
6
7
use Exception;
8
use WSSC\Components\ClientConfig;
9
use WSSC\WebSocketClient;
10
11
class MaxConnectionsBench
12
{
13
    private const WS_SCHEME = 'ws://';
14
    private const WS_HOST = 'localhost';
15
    private const WS_PORT = ':8000';
16
    private const WS_URI = '/notifications/messanger/vkjsndfvjn23243';
17
18
    private string $url = self::WS_SCHEME . self::WS_HOST . self::WS_PORT . self::WS_URI;
19
    private WebSocketClient $client;
20
21
    /**
22
     * @throws \WSSC\Exceptions\BadUriException
23
     * @throws \WSSC\Exceptions\ConnectionException
24
     */
25
    public function __construct()
26
    {
27
        $this->client = new WebSocketClient($this->url, new ClientConfig());
28
    }
29
30
    /**
31
     * @Revs(10000)
32
     * @Iterations(3)
33
     * @throws Exception
34
     */
35
    public function benchConnect(): void
36
    {
37
        $this->client->send('{"user_id" : 123}');
38
    }
39
}
40