FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
framework/examples/soa_server.php at master · metlive/framework · GitHub
metlive
/
framework
Public
forked from
whcyc2002/swoole_framework
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
framework
/
examples
/
soa_server.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (37 loc) · 1.24 KB
Breadcrumbs
framework
/
examples
/
soa_server.php
Copy path
File metadata and controls
42 lines (37 loc) · 1.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
define
(
'
DEBUG
'
,
'
on
'
);
define
(
'
WEBPATH
'
,
realpath
(
__DIR__
.
'
/../
'
));
require
dirname
(
__DIR__
) .
'
/libs/lib_config.php
'
;
//设置PID文件的存储路径
Swoole
\
Network
\Server::
setPidFile
(
__DIR__
.
'
/app_server.pid
'
);
/**
* 显示Usage界面
* php app_server.php start|stop|reload
*/
Swoole
\
Network
\Server::
start
(
function
()
{
$
AppSvr
=
new
Swoole
\
Protocol
\
SOAServer
;
$
AppSvr
->
setLogger
(
new
\
Swoole
\
Log
\
EchoLog
(
true
));
//Logger
/**
* 注册一个自定义的命名空间到SOA服务器
* 默认使用 apps/classes
*/
$
AppSvr
->
addNameSpace
(
'
BL
'
,
__DIR__
.
'
/class
'
);
Swoole
\Error::
$
echo_html
=
false
;
$
server
=
Swoole
\
Network
\Server::
autoCreate
(
'
0.0.0.0
'
,
8888
);
$
server
->
setProtocol
(
$
AppSvr
);
//$server->daemonize(); //作为守护进程
$
server
->
run
(
array
(
//TODO: 实际使用中必须调大进程数
'
worker_num
'
=>
1
,
'
max_request
'
=>
5000
,
'
dispatch_mode
'
=>
3
,
'
open_length_check
'
=>
1
,
'
package_max_length
'
=>
$
AppSvr
->
packet_maxlen
,
'
package_length_type
'
=>
'
N
'
,
'
package_body_offset
'
=> \
Swoole
\
Protocol
\SOAServer::
HEADER_SIZE
,
'
package_length_offset
'
=>
0
,
)
);
});
Back
|
FazBrowse Home
|
New Git URL