正在为 PHP 发送异步消息 Pusher HTTP API
Sending asynchronous message Pusher HTTP API for PHP
我在 for
循环中使用 pusher-http-php 发送消息。 $pusher->trigger
调用等待 return 继续。如果没有 Pusher 消息,循环需要 2-3 秒。使用 trigger
调用,它会导致 504 错误,并且在数据库中花费半个多小时。
有没有办法在 PHP 中异步发送这些消息?
the $pusher->trigger
method makes a synchronous HTTP request to Pusher. You could use $pusher->triggerBatch
减少网络延迟是对的。
如果你真的想让 $pusher->trigger
异步,你可以将它包装在一个异步任务中。 Here's an introduction to async PHP.
我在 for
循环中使用 pusher-http-php 发送消息。 $pusher->trigger
调用等待 return 继续。如果没有 Pusher 消息,循环需要 2-3 秒。使用 trigger
调用,它会导致 504 错误,并且在数据库中花费半个多小时。
有没有办法在 PHP 中异步发送这些消息?
the $pusher->trigger
method makes a synchronous HTTP request to Pusher. You could use $pusher->triggerBatch
减少网络延迟是对的。
如果你真的想让 $pusher->trigger
异步,你可以将它包装在一个异步任务中。 Here's an introduction to async PHP.