大佬们本地webman搞下来之后websocket控制台连接测试失败, 尝试了各种姿势 结果就是一个字 fail
class Websocket
{
public function onConnect(TcpConnection $connection){}
public function onWebSocketConnect(TcpConnection $connection, $http_buffer){}
public function onMessage(TcpConnection $connection, $data)
{
$data = json_decode($data, true);
// Timer::add(1, function() use ($return_ret, $connection, $data){
// // >>>>>>>>>>>>>>>>>>>>>>>
// // 处理代码业务
// // >>>>>>>>>>>>>>>>>>>>>>>
//
// // 发送数据 $return_ret 推送的数据
// $connection->send(json_encode($return_ret));
// });
$data=["code"=>0,'data'=>[1,2,3,4],'msg'=>'success'];
$connection->send(json_encode($data));
}
public function onClose(TcpConnection $connection)
{
// 关闭websocket
$connection->close();
}
}
http 打不开 websocket 也连不上 难道是我姿势不对吗
window
{
"name": "workerman/webman",
"type": "project",
"keywords": [
"high performance",
"http service"
],
"homepage": "https://www.workerman.net",
"license": "MIT",
"description": "High performance HTTP Service Framework.",
"authors": [
{
"name": "walkor",
"email": "walkor@workerman.net",
"homepage": "https://www.workerman.net",
"role": "Developer"
}
],
"support": {
"email": "walkor@workerman.net",
"issues": "https://github.com/walkor/webman/issues",
"forum": "https://wenda.workerman.net/",
"wiki": "https://workerman.net/doc/webman",
"source": "https://github.com/walkor/webman"
},
"require": {
"php": ">=7.2",
"workerman/webman-framework": "^1.5.0",
"monolog/monolog": "^2.0",
"webman/gateway-worker": "^1.0"
},
"suggest": {
"ext-event": "For better performance. "
},
"autoload": {
"psr-4": {
"": "./",
"app\\": "./app",
"App\\": "./app",
"app\\View\\Components\\": "./app/view/components"
},
"files": [
"./support/helpers.php"
]
},
"scripts": {
"post-package-install": [
"support\\Plugin::install"
],
"post-package-update": [
"support\\Plugin::install"
],
"pre-package-uninstall": [
"support\\Plugin::uninstall"
]
}
}
http://127.0.0.1:8787
@roczyl 大佬牛逼
看着有点无奈
没玩过,过来玩一下,之前0.0.0.0进去非常丝滑,突然不行了。
牛。。。。。
我就当你是在夸我了