【问题标题】:Pusher can't trigger an event in codeigniterPusher 无法在 codeigniter 中触发事件
【发布时间】:2018-07-04 14:55:23
【问题描述】:

javascribe 订阅频道如下所示。频道订阅正确。

 var pusher = new Pusher('Appkey', { cluster: 'ap2'});
 var channel = pusher.subscribe('publisher-token-from-javascript');

触发事件的方法

$pusher = new Pusher('$key', '$secret', '$id', $options);

$response = $pusher->trigger('my-channel0000', 'my-event', array('message' => 'hello world'));

推送代码总是返回 null 作为响应

array (size=2)
  'body' => boolean false
  'status' => int 0

【问题讨论】:

    标签: php codeigniter pusher


    【解决方案1】:

    CodeIgniter 的 Pusher 库在连接到备用集群时未更新。旧库始终连接到(默认:http://api.pusherapp.com)主机。要解决您的问题,您必须确保凭据正确。

    为了快速解决您的问题,请检查您是否可以将服务器端配置中的 $config['pusher_host'] 配置为:http://api-[yourcluster].pusher.com

    例子

    $config['pusher_api_key'] = 'XXXXXXXXXXXXX';
    $config['pusher_secret'] = 'XXXXXXXXXXXXXX';
    $config['pusher_app_id'] = 'XXXXXX'; 
    $config['pusher_host'] = 'http://api-eu.pusher.com'; 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-10
      相关资源
      最近更新 更多