mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 07:35:34 +08:00
update to 1.2 version
Generate systemd script Default info_level set to 2 Modify & add some comment for Example module Brand new Console Add daemon command argument Add #OnTick annotation Add ZMRobot API class
This commit is contained in:
@@ -11,7 +11,7 @@ class ConnectionManager
|
||||
/**
|
||||
* 通过server的fd获取WSConnection实例化对象
|
||||
* @param int $fd
|
||||
* @return WSConnection
|
||||
* @return WSConnection|CQConnection|ProxyConnection
|
||||
*/
|
||||
public static function get(int $fd) {
|
||||
foreach (ZMBuf::$connect as $v) {
|
||||
@@ -23,7 +23,7 @@ class ConnectionManager
|
||||
/**
|
||||
* @param string $type
|
||||
* @param array $option
|
||||
* @return WSConnection[]
|
||||
* @return WSConnection[]|CQConnection[]
|
||||
*/
|
||||
public static function getByType(string $type, $option = []) {
|
||||
$conn = [];
|
||||
@@ -70,4 +70,4 @@ class ConnectionManager
|
||||
$classes = getAllClasses(WORKING_DIR . "/src/Custom/Connection/", "Custom\\Connection");
|
||||
ZMBuf::$custom_connection_class = $classes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace ZM\Connection;
|
||||
|
||||
|
||||
use Framework\Console;
|
||||
use Framework\Logger;
|
||||
use swoole_websocket_server;
|
||||
|
||||
abstract class WSConnection
|
||||
@@ -43,10 +42,10 @@ abstract class WSConnection
|
||||
}
|
||||
if ($this->server->push($this->fd, $data) === false) {
|
||||
$data = unicode_decode($data);
|
||||
if ($push_error_record) Logger::writeSwooleLog("API push failed. Data: " . $data);
|
||||
Console::error("websocket数据未成功推送,长度:" . strlen($data));
|
||||
if ($push_error_record) Console::warning("API push failed. Data: " . $data);
|
||||
Console::warning("websocket数据未成功推送,长度:" . strlen($data));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user