How to use the pusher-js 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 muxy / extensions-js / src / messenger.ts View on Github external
constructor(debug: DebugOptions) {
    // @ts-ignore
    this.client = new Pusher('18c26c0d1c7fafb78ba2', {
      cluster: 'us2',
      encrypted: true
    });

    this.channelID = '';
    this.debug = debug;
  }
github amitavroy / vuespa / client_labs / src / components / chat / ChatAddWidget.vue View on Github external
created () {
      this.pusher = new Pusher('49f09fe21ef2b756c13f', {
        encrypted: true,
        cluster: 'mt1'
      })
      let that = this
      this.channel = this.pusher.subscribe('chat_channel')
      this.channel.bind('chat_saved', function (data) {
        that.$emit('incoming_chat', data)
      })
      this.$on('incoming_chat', function (chatMessage) {
        this.incomingChat(chatMessage)
      })
    },
    computed: {
github DCtheTall / node-video-chat / legacy / src / components / connect.jsx View on Github external
connectToHost() {
    this.setState({ connecting: true });

    let pusher = new Pusher('b5ee32e8c6b0d68d380b', {
      authTransport: 'ajax',
      authEndpoint: '/pusher/auth?id=2'
    });

    let channel;
    try {
      channel = pusher.subscribe('presence-chat-'+ this.state.clientID);
    }
    catch(err) {
      console.log(err);
      this.setState({ connecting: false });
      return;
    }

    let peer;
github hubtype / botonic / packages / botonic-core / src / hubtype-service.js View on Github external
init(user, lastMessageId) {
    if (user) this.user = user
    if (lastMessageId) this.lastMessageId = lastMessageId
    if (this.pusher || !this.user.id || !this.appId) return
    this.pusher = new Pusher(PUSHER_KEY, {
      cluster: 'eu',
      authEndpoint: `${HUBTYPE_API_URL}/v1/provider_accounts/webhooks/webchat/${this.appId}/auth/`,
      forceTLS: true,
      auth: {
        headers: {
          'X-BOTONIC-USER-ID': this.user.id,
          'X-BOTONIC-LAST-MESSAGE-ID': this.lastMessageId,
        },
      },
    })
    this.channel = this.pusher.subscribe(this.pusherChannel)
    let connectionPromise = new Promise((resolve, reject) => {
      let cleanAndReject = msg => {
        clearTimeout(connectTimeout)
        this.pusher.connection.unbind()
        this.channel.unbind()
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'),
      },
    },
  });

  return pusher;
};
github hubtype / botonic / packages / botonic-react / src / webchat.jsx View on Github external
constructor(props) {
        super(props)
        this.pusher = new Pusher('da85029877df0c827e44')
        this.appId = this.props.botonicApp.appId
        this.userId = this.getUserUUID()
        this.subscribePusher(this.pusher)
    }
github spatie / dashboard.spatie.be / resources / assets / js / helpers / pusher-channel.js View on Github external
import Pusher from 'pusher-js';

const pusher = new Pusher(dashboard.pusherKey, {
    authEndpoint: '/pusher/authenticate',
});

const pusherChannel = pusher.subscribe('private-dashboard');

export default pusherChannel;
github mbrn / react-basket / demo / PusherBasketDataProvider.ts View on Github external
constructor() {
    this.pusher = new Pusher("5084eb82130619c14d4e", {
      cluster: 'eu',
      forceTLS: true
    });
    this.channel = this.pusher.subscribe("my-channel");

    this.channel.bind('itemAdded', this.basketChanged);
    this.channel.bind('itemUpdated', this.basketChanged);
    this.channel.bind('itemRemoved', this.basketChanged);
    this.channel.bind('cartEmptied', this.basketChanged);
  }

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