简体   繁体   English

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

[英]Is there any way to send data to pusher channel_auth_endpoint?

I´m developing a chat with pusher and i need to send some data to the auth endpoint, is there any way to send data and access it via POST or GET ? 我正在开发与推送器的聊天,我需要将一些数据发送到auth端点,有没有办法发送数据并通过POST或GET访问它?

  Pusher.channel_auth_endpoint = '/server/client_auth';
  pusher = new Pusher('public_key');

Thanks!!! 谢谢!!!

Yes, you can provide additional data to be sent to the auth endpoint when you create your Pusher instance eg 是的,您可以在创建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 } );

More information and use case examples can be found the Pusher docs: http://pusher.com/docs/client_api_guide/client_connect#options_parameter 可以在Pusher文档中找到更多信息和用例示例: http//pusher.com/docs/client_api_guide/client_connect#options_parameter

If this doesn't suit your use case I'd recommend you get in touch with Pusher Support and there may be solutions planned which better solve your requirements. 如果这不适合您的使用案例,我建议您与Pusher支持部门取得联系,并且可能有计划的解决方案可以更好地解决您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM