比如說(shuō)當(dāng)前有3個(gè)用戶在應(yīng)用中是屬于在線的情況,當(dāng)我這時(shí)候stop停止項(xiàng)目,然后在啟動(dòng)項(xiàng)目,最后這3個(gè)用戶都關(guān)閉應(yīng)用離線了,而這時(shí)候我統(tǒng)計(jì)在線用戶的話這3個(gè)用戶就始終一直在線起的,無(wú)法正常離線。
當(dāng)我打印 $result['result']['channels'] 就一直有這三個(gè)用戶
經(jīng)過(guò)各種測(cè)試,好像必須要所有用戶離線的時(shí)候重啟才不出現(xiàn)此情況,或者說(shuō)有用戶在線的時(shí)候就不能stop,只能通過(guò)reload平滑重啟也不會(huì)出現(xiàn)此情況
$api = new Api(
str_replace('0.0.0.0', '127.0.0.1', config('plugin.webman.push.app.api')),
config('plugin.webman.push.app.app_key'),
config('plugin.webman.push.app.app_secret')
);
$result = $api->get('/channels', ['filter_by_prefix' => 'user-line-']);
if ($result || $result['status'] == 200) {
$user_line_ids = []; //在線用戶的id
foreach ($result['result']['channels'] as $k => $v) {
$user_line_ids[] = intval(ltrim($k,'user-line-'));
}
}