功能邏輯是點擊預約按鈕延時通知客戶端
為什么總是時而好使時而不好使呢,哪位大神可以幫我看看么
訂閱
public function onWorkerStart(Worker $worker)
{
$redis = new \Workerman\Redis\Client('redis://127.0.0.1:6379');
$redis->auth('123456');
$redis->subscribe('resty',function ($channel, $message){
echo ' [x] ' . $channel.'|'.$message, "\n";
});
}
發(fā)布
public function publish()
{
$redis = new \Workerman\Redis\Client('redis://127.0.0.1:6379');
$redis->auth('123456');
$redis->publish('resty','Welcome Tinywan publish '.date('Y-m-d H:i:s'));
}
訂閱截圖
估計是業(yè)務邏輯問題。延遲消費要用隊列,用這個 http://www.wtbis.cn/doc/workerman/components/workerman-redis-queue.html
先直接用手冊里的測試例子測試,不加業(yè)務邏輯。測試沒問題然后再一點一點加你的業(yè)務邏輯,這樣好定位。