laravel-s icon indicating copy to clipboard operation
laravel-s copied to clipboard

The operation of websockets and dispatch_mode

Open DevilSerj opened this issue 1 year ago • 2 comments

  1. Your software version (Screenshot of your startup)

+---------------------------+---------+ | Component | Version | +---------------------------+---------+ | PHP | 7.4.33 | | Swoole | 4.8.13 | | LaravelS | 3.7.36 | | Laravel Framework [local] | 8.25.0 | +---------------------------+---------+

  1. Detail description about this issue(error/log)

Why is the default value of dispatch_mode 3 and do you recommend using it? When the value of dispatch_mode = 3 then WARNING Server::start_check(): cannot set 'onClose' event when using dispatch_mode=1/3/7 That is, we will not be able to use onClose in websockets. Do I understand correctly? If I use websockets and I need onClose then I should use dispatch_mode = 2 right?

Thank you for your time!

  1. Some reproducible code blocks and steps

LARAVELS_DISPATCH_MODE=3

DevilSerj avatar Feb 16 '24 02:02 DevilSerj

这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。

uptonyuan avatar Feb 16 '24 02:02 uptonyuan

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

mnizfd avatar Feb 16 '24 02:02 mnizfd

Why is the default value of dispatch_mode 3 and do you recommend using it? When the value of dispatch_mode = 3 then WARNING Server::start_check(): cannot set 'onClose' event when using dispatch_mode=1/3/7

For sync blocking HTTP Server, in order to use the Worker efficiently, it is recommended to set dispatch_mode=3. However, the onClose event cannot be supported under WebSocket Server. And Swoole will give you a WARNING message. If you do not need the onClose event, you can ignore it.

That is, we will not be able to use onClose in websockets. Do I understand correctly? If I use websockets and I need onClose then I should use dispatch_mode = 2 right?

If you want to use the onClose event, you can only set dispatch_mode=2/4/5

hhxsv5 avatar Feb 19 '24 08:02 hhxsv5