1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace BeyondCode\LaravelWebSockets\Server; |
4
|
|
|
|
5
|
|
|
use Exception; |
6
|
|
|
use GuzzleHttp\Psr7\Message; |
7
|
|
|
use GuzzleHttp\Psr7\Response; |
8
|
|
|
use Psr\Http\Message\RequestInterface; |
9
|
|
|
use Ratchet\ConnectionInterface; |
10
|
|
|
use Ratchet\Http\HttpServerInterface; |
11
|
|
|
|
12
|
|
|
class HealthHandler implements HttpServerInterface |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Handle the socket opening. |
16
|
|
|
* |
17
|
|
|
* @param \Ratchet\ConnectionInterface $connection |
18
|
|
|
* @param \Psr\Http\Message\RequestInterface $request |
19
|
|
|
* @return void |
20
|
|
|
*/ |
21
|
|
|
public function onOpen(ConnectionInterface $connection, RequestInterface $request = null) |
22
|
|
|
{ |
23
|
|
|
$response = new Response( |
24
|
|
|
200, |
25
|
|
|
['Content-Type' => 'application/json'], |
26
|
|
|
json_encode(['ok' => true]) |
27
|
|
|
); |
28
|
|
|
|
29
|
|
|
tap($connection)->send(Message::toString($response))->close(); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Handle the incoming message. |
34
|
|
|
* |
35
|
|
|
* @param \Ratchet\ConnectionInterface $connection |
36
|
|
|
* @param string $message |
37
|
|
|
* @return void |
38
|
|
|
*/ |
39
|
|
|
public function onMessage(ConnectionInterface $connection, $message) |
40
|
|
|
{ |
41
|
|
|
// |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Handle the websocket close. |
46
|
|
|
* |
47
|
|
|
* @param \Ratchet\ConnectionInterface $connection |
48
|
|
|
* @return void |
49
|
|
|
*/ |
50
|
|
|
public function onClose(ConnectionInterface $connection) |
51
|
|
|
{ |
52
|
|
|
// |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Handle the websocket errors. |
57
|
|
|
* |
58
|
|
|
* @param \Ratchet\ConnectionInterface $connection |
59
|
|
|
* @param WebSocketException $exception |
|
|
|
|
60
|
|
|
* @return void |
61
|
|
|
*/ |
62
|
|
|
public function onError(ConnectionInterface $connection, Exception $exception) |
63
|
|
|
{ |
64
|
|
|
// |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths