比如說當前有3個用戶在應用中是屬于在線的情況,當我這時候stop停止項目,然后在啟動項目,最后這3個用戶都關閉應用離線了,而這時候我統(tǒng)計在線用戶的話這3個用戶就始終一直在線起的,無法正常離線。
當我打印 $result['result']['channels'] 就一直有這三個用戶
經(jīng)過各種測試,好像必須要所有用戶離線的時候重啟才不出現(xiàn)此情況,或者說有用戶在線的時候就不能stop,只能通過reload平滑重啟也不會出現(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-'));
}
}