How to use the pusher-js.Runtime function in pusher-js

To help you get started, we’ve selected a few pusher-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ivanproskuryakov / messenger / app / service / pusher.js View on Github external
const getPusher = (url) => {
  Pusher.logToConsole = true;
  Pusher.Runtime.createXHR = () => {
    const xhr = new XMLHttpRequest();
    xhr.withCredentials = true;

    return xhr;
  };

  const pusher = new Pusher(params.PUSHER_KEY, {
    cluster: params.PUSHER_CLUSTER,
    authEndpoint: url,
    auth: {
      headers: {
        'Content-Type': 'application/json',
        'X-XSRF-TOKEN': Cookies.get('XSRF-TOKEN'),
      },
    },
  });

pusher-js

Pusher Channels JavaScript library for browsers, React Native, NodeJS and web workers

MIT
Latest version published 5 months ago

Package Health Score

78 / 100
Full package analysis