我正在创建一个随机实时聊天,例如 Omegle。
我无法使用等待列表在私有(private)线程中连接两个随机的人。使用 Laravel Broadcasting 和 Laravel Job 最好的方法是什么?
例如:
Route::get('/start', function () {
// add me to the wait list
// wait for another person
// find another person
// remove me and another person from the wait list
// dispatch event
App\Events\AnotherPersonFound::dispatch($anotherPerson, $threadId);
});
最佳答案
我认为您可以在调度事件后创建一个 channel 并与用户关联。
参见:https://laravel.com/docs/5.7/broadcasting#presence-channels
您还可以使用以下方式发送有关人与人之间新匹配的通知:
关于php - 如何使用 Laravel Broadcasting 在一个线程中连接两个随机的人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52690535/