Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
laravelzh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯超鹏
laravelzh
Commits
a05ea255
Commit
a05ea255
authored
Dec 02, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新wss
parent
a7ecd16c
Pipeline
#170
canceled with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
25 deletions
+25
-25
alarm.php
app/Console/Commands/alarm.php
+6
-6
chemicalswb.php
app/Console/Commands/chemicalswb.php
+5
-5
firewb.php
app/Console/Commands/firewb.php
+3
-3
swoole.php
app/Console/Commands/swoole.php
+3
-3
swooleMeTcp.php
app/Console/Commands/swooleMeTcp.php
+8
-8
No files found.
app/Console/Commands/alarm.php
View file @
a05ea255
...
@@ -57,18 +57,18 @@ class alarm extends Command
...
@@ -57,18 +57,18 @@ class alarm extends Command
{
{
$url
=
config
(
'public.swoolwebsocketurl'
);
$url
=
config
(
'public.swoolwebsocketurl'
);
$por
=
config
(
'public.swoolwebsocketurlpor'
);
$por
=
config
(
'public.swoolwebsocketurlpor'
);
$this
->
ws
=
new
\swoole_websocket_server
(
'0.0.0.0'
,
9601
,
SWOOLE_PROCESS
);
//创建一个端口
$this
->
ws
=
new
\swoole_websocket_server
(
'0.0.0.0'
,
9601
,
SWOOLE_PROCESS
,
SWOOLE_SOCK_TCP
|
SWOOLE_SSL
);
//创建一个端口
$this
->
ws
->
set
(
array
(
$this
->
ws
->
set
(
array
(
'reactor_num'
=>
2
,
//reactor线程数
'reactor_num'
=>
2
,
//reactor线程数
'worker_num'
=>
4
,
//worker进程数
'worker_num'
=>
4
,
//worker进程数
'backlog'
=>
128
,
//Listen队列长度
'backlog'
=>
128
,
//Listen队列长度
'max_request'
=>
10
,
//最大连接
'max_request'
=>
10
,
//最大连接
'daemonize'
=>
0
,
//守护进程
'daemonize'
=>
0
,
//守护进程
// 'ssl_cert_file' => base_path() . '/tests/textcert/ssl.pem
',
'ssl_cert_file'
=>
base_path
()
.
'/cert/apache/iot.zhkjgf.com_public.crt
'
,
// 'ssl_key_file' => base_path() . '/tests/textcert/4544322_
iot.zhkjgf.com.key',
'ssl_key_file'
=>
base_path
()
.
'/cert/apache/
iot.zhkjgf.com.key'
,
//
'ssl_verify_peer' => true,
'ssl_verify_peer'
=>
true
,
//
'ssl_allow_self_signed' => true,
'ssl_allow_self_signed'
=>
true
,
// 'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain
',
'ssl_client_cert_file'
=>
base_path
()
.
'/cert/apache/iot.zhkjgf.com_chain.crt
'
,
));
));
$this
->
ws
->
on
(
'open'
,
function
(
$ws
,
$request
)
{
$this
->
ws
->
on
(
'open'
,
function
(
$ws
,
$request
)
{
// //链接成功
// //链接成功
...
...
app/Console/Commands/chemicalswb.php
View file @
a05ea255
...
@@ -64,11 +64,11 @@ class chemicalswb extends Command
...
@@ -64,11 +64,11 @@ class chemicalswb extends Command
'backlog'
=>
128
,
//Listen队列长度
'backlog'
=>
128
,
//Listen队列长度
'max_request'
=>
10
,
//最大连接
'max_request'
=>
10
,
//最大连接
'daemonize'
=>
0
,
//守护进程
'daemonize'
=>
0
,
//守护进程
'ssl_cert_file'
=>
base_path
()
.
'/
tests/textcert/4544322_
iot.zhkjgf.com_public.crt'
,
'ssl_cert_file'
=>
base_path
()
.
'/
cert/apache/
iot.zhkjgf.com_public.crt'
,
'ssl_key_file'
=>
base_path
()
.
'/tests/textcert/4544322_
iot.zhkjgf.com.key'
,
'ssl_key_file'
=>
base_path
()
.
'/cert/apache/
iot.zhkjgf.com.key'
,
//
'ssl_verify_peer' => true,
'ssl_verify_peer'
=>
true
,
//
'ssl_allow_self_signed' => true,
'ssl_allow_self_signed'
=>
true
,
// 'ssl_client_cert_file' => base_path() . '/tests/textcert/4544322_iot.zhkjgf.com_chain
',
'ssl_client_cert_file'
=>
base_path
()
.
'/cert/apache/iot.zhkjgf.com_chain.crt
'
,
));
));
$this
->
ws
->
on
(
'open'
,
function
(
$ws
,
$request
)
{
$this
->
ws
->
on
(
'open'
,
function
(
$ws
,
$request
)
{
// //链接成功
// //链接成功
...
...
app/Console/Commands/firewb.php
View file @
a05ea255
...
@@ -64,11 +64,11 @@ class firewb extends Command
...
@@ -64,11 +64,11 @@ class firewb extends Command
'backlog'
=>
128
,
//Listen队列长度
'backlog'
=>
128
,
//Listen队列长度
'max_request'
=>
10
,
//最大连接
'max_request'
=>
10
,
//最大连接
'daemonize'
=>
0
,
//守护进程
'daemonize'
=>
0
,
//守护进程
'ssl_cert_file'
=>
base_path
()
.
'/
tests/textcert/4544322_
iot.zhkjgf.com_public.crt'
,
'ssl_cert_file'
=>
base_path
()
.
'/
cert/apache/
iot.zhkjgf.com_public.crt'
,
'ssl_key_file'
=>
base_path
()
.
'/
tests/textcert/4544322_
iot.zhkjgf.com.key'
,
'ssl_key_file'
=>
base_path
()
.
'/
cert/apache/
iot.zhkjgf.com.key'
,
'ssl_verify_peer'
=>
true
,
'ssl_verify_peer'
=>
true
,
'ssl_allow_self_signed'
=>
true
,
'ssl_allow_self_signed'
=>
true
,
'ssl_client_cert_file'
=>
base_path
()
.
'/
tests/textcert/4544322_iot.zhkjgf.com_chain
'
,
'ssl_client_cert_file'
=>
base_path
()
.
'/
cert/apache/iot.zhkjgf.com_chain.crt
'
,
));
));
$this
->
ws
->
on
(
'open'
,
function
(
$ws
,
$request
)
{
$this
->
ws
->
on
(
'open'
,
function
(
$ws
,
$request
)
{
// //链接成功
// //链接成功
...
...
app/Console/Commands/swoole.php
View file @
a05ea255
...
@@ -64,11 +64,11 @@ class swoole extends Command
...
@@ -64,11 +64,11 @@ class swoole extends Command
'backlog'
=>
128
,
//Listen队列长度
'backlog'
=>
128
,
//Listen队列长度
'max_request'
=>
10
,
//最大连接
'max_request'
=>
10
,
//最大连接
'daemonize'
=>
0
,
//守护进程
'daemonize'
=>
0
,
//守护进程
'ssl_cert_file'
=>
base_path
()
.
'/
tests/textcert/4544322_
iot.zhkjgf.com_public.crt'
,
'ssl_cert_file'
=>
base_path
()
.
'/
cert/apache/
iot.zhkjgf.com_public.crt'
,
'ssl_key_file'
=>
base_path
()
.
'/
tests/textcert/4544322_
iot.zhkjgf.com.key'
,
'ssl_key_file'
=>
base_path
()
.
'/
cert/apache/
iot.zhkjgf.com.key'
,
'ssl_verify_peer'
=>
true
,
'ssl_verify_peer'
=>
true
,
'ssl_allow_self_signed'
=>
true
,
'ssl_allow_self_signed'
=>
true
,
'ssl_client_cert_file'
=>
base_path
()
.
'/
tests/textcert/4544322_iot.zhkjgf.com_chain
'
,
'ssl_client_cert_file'
=>
base_path
()
.
'/
cert/apache/iot.zhkjgf.com_chain.crt
'
,
));
));
$this
->
ws
->
on
(
'open'
,
function
(
$ws
,
$request
)
{
$this
->
ws
->
on
(
'open'
,
function
(
$ws
,
$request
)
{
// //链接成功
// //链接成功
...
...
app/Console/Commands/swooleMeTcp.php
View file @
a05ea255
...
@@ -56,9 +56,9 @@ class swooleMeTcp extends Command
...
@@ -56,9 +56,9 @@ class swooleMeTcp extends Command
{
{
$url
=
config
(
'public.swooletcpurl'
);
$url
=
config
(
'public.swooletcpurl'
);
$this
->
tcp
=
new
\swoole_server
(
'0.0.0.0'
,
9503
,
SWOOLE_PROCESS
,
SWOOLE_SOCK_TCP
|
SWOOLE_SSL
);
$this
->
tcp
=
new
\swoole_server
(
'0.0.0.0'
,
9503
,
SWOOLE_PROCESS
,
SWOOLE_SOCK_TCP
|
SWOOLE_SSL
);
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9504
,
SWOOLE_
PROCESS
,
SWOOLE_
SOCK_TCP
|
SWOOLE_SSL
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9504
,
SWOOLE_SOCK_TCP
|
SWOOLE_SSL
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9505
,
SWOOLE_
PROCESS
,
SWOOLE_
SOCK_TCP
|
SWOOLE_SSL
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9505
,
SWOOLE_SOCK_TCP
|
SWOOLE_SSL
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9506
,
SWOOLE_
PROCESS
,
SWOOLE_
SOCK_TCP
|
SWOOLE_SSL
);
// 添加 TCP端口监听
$this
->
tcp
->
addlistener
(
'0.0.0.0'
,
9506
,
SWOOLE_SOCK_TCP
|
SWOOLE_SSL
);
// 添加 TCP端口监听
$this
->
tcp
->
set
([
$this
->
tcp
->
set
([
'worker_num'
=>
2
,
//设置启动的 Worker 进程数
'worker_num'
=>
2
,
//设置启动的 Worker 进程数
'max_request'
=>
30
,
//最大任务数
'max_request'
=>
30
,
//最大任务数
...
@@ -67,18 +67,18 @@ class swooleMeTcp extends Command
...
@@ -67,18 +67,18 @@ class swooleMeTcp extends Command
'backlog'
=>
128
,
'backlog'
=>
128
,
'heartbeat_check_interval'
=>
30
,
'heartbeat_check_interval'
=>
30
,
'heartbeat_idle_time'
=>
65
,
'heartbeat_idle_time'
=>
65
,
'ssl_cert_file'
=>
base_path
()
.
'/
tests/textcert/4544322_
iot.zhkjgf.com_public.crt'
,
'ssl_cert_file'
=>
base_path
()
.
'/
cert/apache/
iot.zhkjgf.com_public.crt'
,
'ssl_key_file'
=>
base_path
()
.
'/
tests/textcert/4544322_
iot.zhkjgf.com.key'
,
'ssl_key_file'
=>
base_path
()
.
'/
cert/apache/
iot.zhkjgf.com.key'
,
'ssl_verify_peer'
=>
true
,
'ssl_verify_peer'
=>
true
,
'ssl_allow_self_signed'
=>
true
,
'ssl_allow_self_signed'
=>
true
,
'ssl_client_cert_file'
=>
base_path
()
.
'/
tests/textcert/4544322_iot.zhkjgf.com_chain
'
,
'ssl_client_cert_file'
=>
base_path
()
.
'/
cert/apache/iot.zhkjgf.com_chain.crt
'
,
]);
]);
//监听连接进入事件
//监听连接进入事件
$this
->
tcp
->
on
(
'Connect'
,
function
(
$serv
,
$fd
)
{
$this
->
tcp
->
on
(
'Connect'
,
function
(
$serv
,
$fd
)
{
$data
=
[
$data
=
[
'stats[得到当前 Server 的活动 TCP 连接数]'
=>
$this
->
tcp
->
stats
(),
'stats[得到当前 Server 的活动 TCP 连接数]'
=>
$this
->
tcp
->
stats
(),
'getClientInfo[获取连接的信息]'
=>
$this
->
tcp
->
getClientInfo
(
$fd
,
1
,
true
)
'getClientInfo[获取连接的信息]'
=>
$this
->
tcp
->
getClientInfo
(
$fd
,
1
,
true
)
];
//链接信息写入.log
];
//链接信息写入.log
Log
::
channel
(
'slack'
)
->
info
(
$data
);
Log
::
channel
(
'slack'
)
->
info
(
$data
);
$serv
->
send
(
$fd
,
'连接成功'
.
','
.
'id=>'
.
$fd
);
$serv
->
send
(
$fd
,
'连接成功'
.
','
.
'id=>'
.
$fd
);
...
@@ -112,4 +112,4 @@ class swooleMeTcp extends Command
...
@@ -112,4 +112,4 @@ class swooleMeTcp extends Command
}
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment