Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cdz_gateway
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨苏杭
cdz_gateway
Commits
2bd9d258
Commit
2bd9d258
authored
Jul 30, 2018
by
BANice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改心跳和环境数据
parent
4e6e37f7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
24 deletions
+8
-24
.idea/workspace.xml
+0
-0
Application/start_gateway.php
+8
-24
No files found.
.idea/workspace.xml
View file @
2bd9d258
This diff is collapsed.
Click to expand it.
Application/start_gateway.php
View file @
2bd9d258
...
@@ -11,9 +11,11 @@
...
@@ -11,9 +11,11 @@
* @link http://www.workerman.net/
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
*/
use
\Workerman\Worker
;
use
\Workerman\Worker
;
use
\GatewayWorker\Gateway
;
use
\GatewayWorker\Gateway
;
use
Lib\Env
;
use
Lib\Env
;
// gateway 进程,这里使用Text协议,可以用telnet测试
// gateway 进程,这里使用Text协议,可以用telnet测试
$gateway
=
new
Gateway
(
"bintohex://0.0.0.0:8282"
);
$gateway
=
new
Gateway
(
"bintohex://0.0.0.0:8282"
);
// gateway名称,status方便查看
// gateway名称,status方便查看
...
@@ -29,35 +31,17 @@ $gateway->lanIp = Env::get('GATEWAY_IP');
...
@@ -29,35 +31,17 @@ $gateway->lanIp = Env::get('GATEWAY_IP');
// 则一般会使用4000 4001 4002 4003 4个端口作为内部通讯端口
// 则一般会使用4000 4001 4002 4003 4个端口作为内部通讯端口
$gateway
->
startPort
=
Env
::
get
(
'GATEWAY_START_PORT'
);
$gateway
->
startPort
=
Env
::
get
(
'GATEWAY_START_PORT'
);
// 服务注册地址
// 服务注册地址
$gateway
->
registerAddress
=
Env
::
get
(
'REGISTER_IP'
)
.
':'
.
Env
::
get
(
'REGISTER_PORT'
);
$gateway
->
registerAddress
=
Env
::
get
(
'REGISTER_IP'
)
.
':'
.
Env
::
get
(
'REGISTER_PORT'
);
// 心跳间隔
// 心跳间隔
$gateway
->
pingInterval
=
6
0
;
$gateway
->
pingInterval
=
4
0
;
// 心跳数据
// 心跳数据
$gateway
->
pingData
=
'ff'
;
$gateway
->
pingNotResponseLimit
=
2
;
$gateway
->
pingNotResponseLimit
=
3
;
/*
// 当客户端连接上来时,设置连接的onWebSocketConnect,即在websocket握手时的回调
$gateway->onConnect = function($connection)
{
$connection->onWebSocketConnect = function($connection , $http_header)
{
// 可以在这里判断连接来源是否合法,不合法就关掉连接
// $_SERVER['HTTP_ORIGIN']标识来自哪个站点的页面发起的websocket链接
if($_SERVER['HTTP_ORIGIN'] != 'http://kedou.workerman.net')
{
$connection->close();
}
// onWebSocketConnect 里面$_GET $_SERVER是可用的
// var_dump($_GET, $_SERVER);
};
};
*/
// 如果不是在根目录启动,则运行runAll方法
// 如果不是在根目录启动,则运行runAll方法
if
(
!
defined
(
'GLOBAL_START'
))
{
if
(
!
defined
(
'GLOBAL_START'
))
{
Worker
::
runAll
();
Worker
::
runAll
();
}
}
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