1 | <?php |
||||
2 | |||||
3 | require '../vendor/autoload.php'; |
||||
4 | |||||
5 | if (!extension_loaded('swoole')) { |
||||
6 | dl('swoole.so'); |
||||
7 | } |
||||
8 | |||||
9 | use darknet\core; |
||||
10 | |||||
11 | $dn = new core(core::YOLOFASTEST); |
||||
12 | |||||
13 | $server = new Swoole\WebSocket\Server("0.0.0.0", 8080); |
||||
0 ignored issues
–
show
|
|||||
14 | |||||
15 | $server->on("start", function (Swoole\WebSocket\Server $server) { |
||||
0 ignored issues
–
show
The parameter
$server is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
16 | echo "Swoole WebSocket Server is started at ws://0.0.0.0:8080\n"; |
||||
17 | }); |
||||
18 | |||||
19 | $server->on('open', function(Swoole\WebSocket\Server $server, Swoole\Http\Request $request) { |
||||
0 ignored issues
–
show
The type
Swoole\Http\Request was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
20 | echo "connection open: {$request->fd}\n"; |
||||
21 | }); |
||||
22 | |||||
23 | $server->on('message', function(Swoole\WebSocket\Server $server, Swoole\WebSocket\Frame $frame) use($dn) { |
||||
0 ignored issues
–
show
The type
Swoole\WebSocket\Frame was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
24 | echo "received: " . strlen($frame->data) . " bytes\n"; |
||||
25 | foreach ($server->getClientList(0) as $client) { |
||||
26 | if ($frame->fd !== $client) { |
||||
27 | if ($dn->base64ImgDecode($frame->data) !== null) { |
||||
28 | $dn->remotePR($client, $frame, $server); |
||||
29 | } |
||||
30 | } |
||||
31 | } |
||||
32 | }); |
||||
33 | |||||
34 | $server->on('close', function(Swoole\WebSocket\Server $server, int $fd) { |
||||
35 | echo "connection close: {$fd}\n"; |
||||
36 | }); |
||||
37 | |||||
38 | $server->start(); |
||||
39 |
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