简体   繁体   中英

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 ?

  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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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