有没有办法将数据发送到pusher channel_auth_endpoint?

mda*_*rre 3 javascript php authentication pusher

我正在开发与推送器的聊天,我需要将一些数据发送到auth端点,有没有办法发送数据并通过POST或GET访问它?

  Pusher.channel_auth_endpoint = '/server/client_auth';
  pusher = new Pusher('public_key');
Run Code Online (Sandbox Code Playgroud)

谢谢!!!

leg*_*ter 6

是的,您可以在创建Pusher实例时提供要发送到auth端点的其他数据,例如

var authOptions = {
  headers: {
    'header-1': 'header-value-1',
    'header-2': 'header-value-1'
  },
  params: {
    'param-1': 'param-value-1',
    'param-2': 'param-value-2'
  }
};
var pusher = new Pusher( APP_KEY, { auth: authOptions } );
Run Code Online (Sandbox Code Playgroud)

可以在Pusher文档中找到更多信息和用例示例:http: //pusher.com/docs/client_api_guide/client_connect#options_parameter

如果这不适合您的使用案例,我建议您与Pusher支持部门取得联系,并且可能有计划的解决方案可以更好地解决您的要求.