作者 潘浩文
1 个管道 的构建 通过 耗费 0 秒

websocket协议测试

... ... @@ -31,7 +31,8 @@
"weiwei/api-doc": "^1.6",
"hooklife/thinkphp5-wechat": "^1.1",
"topthink/think-worker": "^2.0",
"workerman/workerman-for-win": "^3.5"
"workerman/workerman-for-win": "^3.5",
"topthink/think-orm": "^1.2"
},
"extra": {
},
... ...
<?php
use Workerman\Worker;
use think\Db;
// 数据库配置信息设置(全局有效)
require_once __DIR__ . '/simplewind/vendor/workerman/workerman/Autoloader.php';
//$global_uid = 0;
... ... @@ -122,7 +124,7 @@ require_once __DIR__ . '/simplewind/vendor/workerman/workerman/Autoloader.php';
// 创建一个Worker监听2347端口,不使用任何应用层协议
$tcp_worker = new Worker("websocket://114.215.223.17:5001");
//Db::setConfig(['数据库配置参数(数组)']);
//$tcp_worker->name='panhaowen';
// 启动4个进程对外提供服务
$tcp_worker->count = 1;
... ... @@ -131,7 +133,7 @@ $tcp_worker->count = 1;
$tcp_worker->onMessage = function($connection, $data)
{
// 向客户端发送hello $data
$connection->send('hello ' . $data);
$connection->send('hello '. $data);
if ($data=='tom') {
Db::name('user')->where('id',1)->update(['sex'=>1]);
}
... ...
... ... @@ -18,6 +18,7 @@ return array(
'b248b9358a8992876b21eddc15455b97' => $vendorDir . '/hooklife/thinkphp5-wechat/src/helper.php',
'841780ea2e1d6545ea3a253239d59c05' => $vendorDir . '/qiniu/php-sdk/src/Qiniu/functions.php',
'1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php',
'33197a0023ced5fbf8f861d1c4ca048d' => $vendorDir . '/topthink/think-orm/src/config.php',
'ffc1d7141d4fcbaeb47a6929f0811ed1' => $vendorDir . '/topthink/think-worker/src/command.php',
'644e9cafc67b331e17cc7661548f33d0' => $vendorDir . '/weiwei/api-doc/src/helper.php',
);
... ...
... ... @@ -10,7 +10,7 @@ return array(
'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'),
'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'),
'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'),
'think\\' => array($vendorDir . '/topthink/think-image/src'),
'think\\' => array($vendorDir . '/topthink/think-image/src', $vendorDir . '/topthink/think-orm/src'),
'mindplay\\annotations\\' => array($vendorDir . '/mindplay/annotations/src/annotations'),
'Workerman\\' => array($vendorDir . '/workerman/workerman', $vendorDir . '/workerman/workerman-for-win'),
'Symfony\\Polyfill\\Php70\\' => array($vendorDir . '/symfony/polyfill-php70'),
... ...
... ... @@ -19,6 +19,7 @@ class ComposerStaticInit929fb365b9981d29459d58f676689cf7
'b248b9358a8992876b21eddc15455b97' => __DIR__ . '/..' . '/hooklife/thinkphp5-wechat/src/helper.php',
'841780ea2e1d6545ea3a253239d59c05' => __DIR__ . '/..' . '/qiniu/php-sdk/src/Qiniu/functions.php',
'1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php',
'33197a0023ced5fbf8f861d1c4ca048d' => __DIR__ . '/..' . '/topthink/think-orm/src/config.php',
'ffc1d7141d4fcbaeb47a6929f0811ed1' => __DIR__ . '/..' . '/topthink/think-worker/src/command.php',
'644e9cafc67b331e17cc7661548f33d0' => __DIR__ . '/..' . '/weiwei/api-doc/src/helper.php',
);
... ... @@ -114,6 +115,7 @@ class ComposerStaticInit929fb365b9981d29459d58f676689cf7
'think\\' =>
array (
0 => __DIR__ . '/..' . '/topthink/think-image/src',
1 => __DIR__ . '/..' . '/topthink/think-orm/src',
),
'mindplay\\annotations\\' =>
array (
... ...
... ... @@ -1684,6 +1684,47 @@
]
},
{
"name": "topthink/think-orm",
"version": "v1.2.12",
"version_normalized": "1.2.12.0",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-orm.git",
"reference": "7c1de8b1045ecdd3a9a2b0a7713cae95f68db85d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-orm/zipball/7c1de8b1045ecdd3a9a2b0a7713cae95f68db85d",
"reference": "7c1de8b1045ecdd3a9a2b0a7713cae95f68db85d",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"time": "2018-10-18T02:26:56+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"think\\": "src"
},
"files": [
"src/config.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "think orm"
},
{
"name": "topthink/think-worker",
"version": "v2.0.10",
"version_normalized": "2.0.10.0",
... ...