|
@@ -66,7 +66,7 @@ class SocketServer extends Command
|
|
|
{
|
|
{
|
|
|
try {
|
|
try {
|
|
|
//创建websocket服务器对象,监听0.0.0.0:7104端口
|
|
//创建websocket服务器对象,监听0.0.0.0:7104端口
|
|
|
- $this->ws = new \Swoole\WebSocket\Server("0.0.0.0", env('SOCKET_PORT', '6630'));
|
|
|
|
|
|
|
+ $this->ws = new \Swoole\WebSocket\Server("0.0.0.0", env('SOCKET_PORT', '6530'));
|
|
|
|
|
|
|
|
//监听WebSocket连接打开事件
|
|
//监听WebSocket连接打开事件
|
|
|
$this->ws->on('open', [$this, 'open']);
|
|
$this->ws->on('open', [$this, 'open']);
|
|
@@ -362,10 +362,11 @@ class SocketServer extends Command
|
|
|
{
|
|
{
|
|
|
if ($this->ws) {
|
|
if ($this->ws) {
|
|
|
// 直接杀
|
|
// 直接杀
|
|
|
|
|
+ $port = env('SOCKET_PORT', '6530');
|
|
|
if(function_exists('exec')){
|
|
if(function_exists('exec')){
|
|
|
- exec('pkill -9 swoole:socket start');
|
|
|
|
|
|
|
+ exec('pid=$(lsof -F p -i:'.$port.' | cut -b 2-) && pkill -9 $pid');
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
echo "socket stop...\n";
|
|
echo "socket stop...\n";
|
|
|
$date = date('Y-m-d H:i:s');
|
|
$date = date('Y-m-d H:i:s');
|
|
|
$this->info("【{$date}】Socket:停止运行服务");
|
|
$this->info("【{$date}】Socket:停止运行服务");
|