Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
wallet
token
Commits
eb1c5912
Commit
eb1c5912
authored
Aug 14, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
61ec3e90
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
WorkermanWebSocketController.php
console/controllers/WorkermanWebSocketController.php
+6
-6
No files found.
console/controllers/WorkermanWebSocketController.php
View file @
eb1c5912
...
...
@@ -13,8 +13,8 @@ class WorkermanWebSocketController extends Controller
// 这里不需要设置,会读取配置文件中的配置
public
$config
=
[];
private
$ip
=
'
127.0.0.1
'
;
private
$port
=
'
2346
'
;
private
$ip
=
'
0.0.0.0
'
;
private
$port
=
'
8080
'
;
public
function
options
(
$actionID
)
{
...
...
@@ -68,9 +68,9 @@ class WorkermanWebSocketController extends Controller
// Emitted when data received
$wsWorker
->
onMessage
=
function
(
$connection
,
$data
)
{
// ssl需要访问443端口
$con
=
new
\Workerman\Connection\AsyncTcpConnection
(
"ws
s
://stream.binance.com:9443/ws/!ticker@arr"
);
$con
=
new
\Workerman\Connection\AsyncTcpConnection
(
"ws://stream.binance.com:9443/ws/!ticker@arr"
);
// 设置以ssl加密方式访问,使之成为wss
//
$con->transport = 'ssl';
$con
->
transport
=
'ssl'
;
// $con->onConnect = function($con) {
// $data = json_encode([
// 'sub' => 'market.btcusdt.kline.1min',
...
...
@@ -78,11 +78,11 @@ class WorkermanWebSocketController extends Controller
// ]);
// $con->send($data);
// };
$con
->
onMessage
=
function
(
$con
,
$data
)
use
(
$connection
)
{
$connection
->
send
(
'hello
: '
.
$data
);
$connection
->
send
(
date
(
"Y-m-d H:i:s"
)
.
'
: '
.
$data
);
};
$con
->
connect
();
//$connection->send('dddd hello ' . $data);
};
// Emitted when connection closed
...
...
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