1
|
|
|
<?php |
2
|
|
|
namespace Laravoole; |
3
|
|
|
|
4
|
|
|
return [ |
5
|
|
|
// for laravoole itself |
6
|
|
|
'base_config' => [ |
7
|
|
|
'host' => env('LARAVOOLE_HOST', '127.0.0.1'), |
8
|
|
|
'port' => env('LARAVOOLE_PORT', 9050), |
9
|
|
|
|
10
|
|
|
// this file storages the pid of laravoole |
11
|
|
|
'pid_file' => env('LARAVOOLE_PID_FILE', storage_path('/logs/laravoole.pid')), |
12
|
|
|
|
13
|
|
|
// when using Http mode, you can turn on this option to let laravoole send static resources to clients |
14
|
|
|
// ONLY use this when developing |
15
|
|
|
'deal_with_public' => env('LARAVOOLE_DEAL_WITH_PUBLIC', false), |
16
|
|
|
|
17
|
|
|
// enable gzip |
18
|
|
|
'gzip' => extension_loaded('zlib') && env('LARAVOOLE_GZIP', 1), |
19
|
|
|
|
20
|
|
|
'gzip_min_length' => env('LARAVOOLE_GZIP_MIN_LENGTH', 1024), |
21
|
|
|
|
22
|
|
|
// laravoole modes: |
23
|
|
|
// SwooleHttp uses swoole to response http requests |
24
|
|
|
// SwooleFastCGI uses swoole to response fastcgi requests (just like php-fpm) |
25
|
|
|
// SwooleWebSocket uses swoole to response websocket requests and http requests |
26
|
|
|
// WorkermanFastCGI uses workerman to response fastcgi requests (just like php-fpm) |
27
|
|
|
'mode' => env('LARAVOOLE_MODE', function () { |
28
|
|
|
if (extension_loaded('swoole')) { |
29
|
|
|
return 'SwooleHttp'; |
30
|
|
|
} elseif (class_exists('Workerman\Worker')) { |
31
|
|
|
return 'WorkermanFastCGI'; |
32
|
|
|
} else { |
33
|
|
|
return; |
34
|
|
|
} |
35
|
|
|
}), |
36
|
|
|
|
37
|
|
|
// response header server |
38
|
|
|
'server' => env('LARAVOOLE_SERVER', 'Laravoole'), |
39
|
|
|
|
40
|
|
|
'callbacks' => [ |
41
|
|
|
// MUST be static methods in array format like ['classname', 'method'] |
42
|
|
|
'bootstraping' => [ |
43
|
|
|
// ['foo', 'bar'], |
|
|
|
|
44
|
|
|
], |
45
|
|
|
'bootstraped' => [ |
46
|
|
|
], |
47
|
|
|
], |
48
|
|
|
], |
49
|
|
|
|
50
|
|
|
// for swoole / workerman |
51
|
|
|
'handler_config' => [ |
52
|
|
|
'max_request' => env('LARAVOOLE_MAX_REQUEST', 2000), |
53
|
|
|
'daemonize' => env('LARAVOOLE_DAEMONIZE', 1), |
54
|
|
|
], |
55
|
|
|
|
56
|
|
|
// for wrapper, like http / fastcgi / websocket |
57
|
|
|
'wrapper_config' => [ |
58
|
|
|
// websocket default protocol |
59
|
|
|
'websocket_default_protocol' => env('LARAVOOLE_WEBSOCKET_DEFAULT_PROTOCOL', 'jsonrpc'), |
60
|
|
|
|
61
|
|
|
'websocket_protocols' => [ |
62
|
|
|
'jsonrpc' => \Laravoole\WebsocketCodec\JsonRpc::class, |
63
|
|
|
], |
64
|
|
|
|
65
|
|
|
// Uncomment below if you want to use your own task callbacks |
66
|
|
|
/* |
|
|
|
|
67
|
|
|
'swoole_ontask' => [ |
68
|
|
|
Laravoole\Wrapper\SwooleWebSocketWrapper::class, 'onTask', |
69
|
|
|
], |
70
|
|
|
|
71
|
|
|
'swoole_onfinish' => [ |
72
|
|
|
Laravoole\Wrapper\SwooleWebSocketWrapper::class, 'onFinish', |
73
|
|
|
], |
74
|
|
|
*/ |
75
|
|
|
], |
76
|
|
|
|
77
|
|
|
]; |
78
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.