FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
AsyncWebSocketClient/WebSocketTest.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
/
WebSocketTest.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (27 loc) · 704 Bytes
Breadcrumbs
AsyncWebSocketClient
/
WebSocketTest.php
Copy path
File metadata and controls
33 lines (27 loc) · 704 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
30
31
32
33
<?php
/**
* Created by PhpStorm.
* User: marsnowxiao
* Date: 2017/6/15
* Time: 下午7:45
*/
require
"
WebSocketClient.php
"
;
$
client
=
new
WebSocketClient
();
$
client
->
on
(
"
open
"
,
function
(
$
client
) {
$
fd
=
$
client
->
getTcpClient
()->
sock
;
echo
"
fd:
$
fd
is open
\n"
;
$
msg
= [
"
path
"
=>
"
/index/index/index
"
,
"
data
"
=>
"
hhh
"
];
$
client
->
send
(
json_encode
(
$
msg
));
});
$
client
->
on
(
"
message
"
,
function
(
$
client
,
$
frame
) {
$
fd
=
$
client
->
getTcpClient
()->
sock
;
echo
"
fd:
$
fd
received:
{
$
frame
->
data
}\n"
;
});
$
client
->
on
(
"
close
"
,
function
(
$
client
) {
$
fd
=
$
client
->
getTcpClient
()->
sock
;
echo
"
fd:
$
fd
is closed
\n"
;
});
$
client
->
connect
(
"
127.0.0.1
"
,
9502
);
Back
|
FazBrowse Home
|
New Git URL