![](/img/trans.png)
[英]Laravel Echo BroadcastException in PusherBroadcaster.php line 106: Unknown auth_key
[英]Pusher in php - Do not send events [ Unknown auth_key]
我使用以下代碼:
require('pusher-http-php-master/lib/Pusher.php');
error_reporting(E_ALL);
$app_id = '*';
$app_key = '*';
$app_secret = '*';
class MyLogger {
public function log( $msg ) {
print_r( $msg . "<br />" );
}
}
$pusher = new Pusher($app_key, $app_secret, $app_id);
$logger = new MyLogger();
$pusher->set_logger( $logger );
$data['message'] = 'hello world';
$result = $pusher->trigger('test_channel', 'my_event', array( 'hello' => 'world' ));
$logger->log( "---- My Result ---" );
$logger->log( $result );
我的答案是:
Pusher: ->trigger received string channel "test_channel". Converting to array. Pusher: create_curl( http://api.pusherapp.com:80/apps/*/events?auth_key=*&auth_signature=*&auth_timestamp=*&auth_version=1.0&body_md5=*) Pusher: trigger POST: {"name":"my_event","data":"{\"hello\":\"world\"}","channels":["test_channel"]} Pusher: exec_curl response: Array ( [body] => Unknown auth_key [status] => 400 ) ---- My Result ---
我究竟做錯了什么?
我想要的是從服務器發送通知。
我懷疑你的cluster
可能是錯的。
在dashboard.pusher.com上創建Pusher應用程序時,系統會要求您選擇cluster
:
pusher-http-php-master
默認連接到mt1 (us-east-1)
。 如果你選擇了另一個集群 - 比如eu (eu-west-1)
- 你需要明確:
$pusher = new Pusher(
$app_key,
$app_secret,
$app_id,
array( 'cluster' => 'eu' )
);
如果不行,我會
仔細
檢查三倍的$app_secret
。
當我使用Pusher和Lumen時,我遇到了同樣的問題。 對我來說,有效的是我從作曲家中刪除了包並重新安裝了包。
第一
composer remove pusher/pusher-php-server
然后
composer require pusher/pusher-php-server
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.