FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
AsyncWebSocketClient/WebSocketServer.php at master · 1403903615/AsyncWebSocketClient · GitHub
1403903615
AsyncWebSocketClient
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
AsyncWebSocketClient
/
WebSocketServer.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (24 loc) · 535 Bytes
Breadcrumbs
AsyncWebSocketClient
/
WebSocketServer.php
Copy path
File metadata and controls
29 lines (24 loc) · 535 Bytes
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
<?php
/**
* Created by PhpStorm.
* User: marsnowxiao
* Date: 2017/6/15
* Time: 下午9:08
*/
$
ws
=
new
swoole_websocket_server
(
"
0.0.0.0
"
,
9502
);
$
ws
->
set
([
'
worker_num
'
=>
1
,
'
backlog
'
=>
128
,
'
max_request
'
=>
50
,
'
dispatch_mode
'
=>
2
,
]);
$
ws
->
on
(
'
open
'
,
function
(
$
ws
,
$
request
) {
$
ws
->
push
(
$
request
->
fd
,
"
hello, welcome
"
);
});
$
ws
->
on
(
'
message
'
,
function
(
$
ws
,
$
frame
) {
$
ws
->
push
(
$
frame
->
fd
,
"
abcd
"
);
});
$
ws
->
on
(
'
close
'
,
function
(
$
ws
,
$
fd
) {
echo
"
client-
{
$
fd
}
is closed
\n"
;
});
$
ws
->
start
();
Back
|
FazBrowse Home
|
New Git URL