1.
webman,主要用于http服務(wù),如果想做RPC服務(wù),應(yīng)該如何下手,文檔里也沒有相關(guān)資料
2.
如果想做websocket服務(wù)端,是不是只能通過自定義進程process來實現(xiàn)?
3.
webman,沒有連接池,那是不是每個進程,都維持一個MySQL長連接呢,每個請求都復(fù)用這個MySQL長連接?
\support\bootstrap\db\Heartbeat.php
<?php
/**
* This file is part of webman.
*
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.wtbis.cn/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace support\bootstrap\db;
use Webman\Bootstrap;
use support\Db;
/**
* mysql心跳。定時發(fā)送一個查詢,防止mysql連接長時間不活躍被mysql服務(wù)端斷開。
* 默認(rèn)不開啟,如需開啟請到 config/bootstrap.php中添加 support\bootstrap\db\Heartbeat::class,
* @package support\bootstrap\db
*/
class Heartbeat implements Bootstrap
{
/**
* @param \Workerman\Worker $worker
*
* @return void
*/
public static function start($worker)
{
\Workerman\Timer::add(55, function (){
Db::select('select 1 limit 1');
});
}
}
1、像@latin 說的,可以參考 https://wenda.workerman.net/question/6057
2、只能通過定義進程process來實現(xiàn),webman自帶一個demo
3、每個進程都維持一個mysql連接,當(dāng)前進程的每個請求都復(fù)用這個連接
https://wenda.workerman.net/question/6460 數(shù)據(jù)庫加載項從webman中獨立出來,單獨初始化,可以和webnan一個時間啟動.在webman 路徑可以隨便調(diào)用數(shù)據(jù)庫,不需要初始化和在composer 里做額外的工作.webman 昨天的問題已完美解決,有類似的問題歡迎兄弟們交流.謝謝兄弟們.