How to use the actioncable/lib/assets/compiled/action_cable.createConsumer function in actioncable

To help you get started, we’ve selected a few actioncable 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 NullVoxPopuli / tanqueReact / frontend / js / actions / action-cable-actions.js View on Github external
return (dispatch, getState) => {
    let state = getState();
    if (state.cable.status === ACTION_CABLE_CONNECTED) {
      return;
    }

    let { uid, url } = state.config;

    let path = `${url}?uid=${uid}`;

    let cable = ActionCable.createConsumer(path);
    let channel = cable.subscriptions.create({ channel: 'MeshRelayChannel', }, {
      connected: () => dispatch(connected(cable)),
      disconnected: data => dispatch(disconnected(data)),
      rejected: data => dispatch(rejected(data)),
      received: data => dispatch(received(data)),
    });
  };
}

actioncable

WebSocket framework for Ruby on Rails.

MIT
Latest version published 2 years ago

Package Health Score

78 / 100
Full package analysis