How to use the pusher-js.logToConsole 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 chatwoot / chatwoot / app / javascript / dashboard / helper / pusher.js View on Github external
init() {
    // Log only if env is testing or development.
    Pusher.logToConsole = CONSTANTS.PUSHER.logToConsole || true;
    // Init Pusher
    const options = {
      encrypted: true,
      app: window.WOOT,
      cluster: CONSTANTS.PUSHER.cluster,
    };
    const pusher = new VuePusher(CONSTANTS.PUSHER.token, options);
    // Add to global Obj
    if (AuthAPI.isLoggedIn()) {
      pusher.subscribe(AuthAPI.getPubSubToken());
      return pusher.pusher;
    }
    return null;
  },
};
github frankcalise / react-context-pusher / src / App.js View on Github external
import React from "react";
import Pusher from "pusher-js";
import { PUSHER_CONFIG } from "./config/pusher.config";
import "./App.css";
import { PusherProvider } from "./PusherContext";
import { Child } from "./Child";

// Enable pusher logging - don't include this in production
Pusher.logToConsole = true;

// Set up pusher instance with main channel subscription
// Be able to subscribe to the same channel in another component
// with separate callback but utilizing the existing connection
const pusher = new Pusher(PUSHER_CONFIG.key, {
  cluster: PUSHER_CONFIG.cluster,
  forceTLS: true
});

function App() {
  return (
    
      <div>
        <header>Context API w/ Pusher real-time</header>
        <main>
          <span>Put some main component here</span></main></div>
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'),
      },
    },
github Lumeer / web-ui / src / app / core / pusher / pusher.service.ts View on Github external
private subscribePusher(user: User): void {
    Pusher.logToConsole = !environment.pusherLogDisabled;
    this.pusher = new Pusher(environment.pusherKey, {
      cluster: environment.pusherCluster,
      authEndpoint: `${environment.apiUrl}/rest/pusher`,
      auth: {
        headers: {
          Authorization: `Bearer ${this.authService.getAccessToken()}`,
        },
      },
    });

    this.channel = this.pusher.subscribe('private-' + user.id);

    this.bindOrganizationEvents();
    this.bindProjectEvents();
    this.bindViewEvents();
    this.bindCollectionEvents();

pusher-js

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

MIT
Latest version published 12 months ago

Package Health Score

72 / 100
Full package analysis