Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)),
});
};
}