laravel-echo-redux
v1.0.4
Published
laravel-echo + redux
Downloads
10
Readme
laravel-echo-redux
Getting Started
Installing
npm i laravel-echo-redux
Import
import EchoRedux from 'laravel-echo-redux';
Usage
Initialization
Create a config object and assign it with an argument to the init() method;
const config = {
store, //Redux store (required)
debug: true, //Debug mode on/off (optional)
host: process.env.MIX_APP_URL + ':6001',
encrypted: true,
}
EchoRedux.init(config)
Subscribe channel
Public channel
//EchoRedux.subscribe(channelName,eventName,actionType);
EchoRedux.subscribe('TestChannel','TestEvent','SOCKET_TEST_EVENT_DATA');
or
//EchoRedux.subscribe(channelName,eventName,actionType);
EchoRedux.subscribe('TestChannel',['TestEvent','TestEvent2'],['ACTION_TEST_EVENT_DATA', 'ACTION_TEST_EVENT2_DATA']);
Private channel
//EchoRedux.subscribePrivate(channelName,eventName,actionType);
EchoRedux.subscribePrivate('TestChannel','TestEvent','ACTION_TEST_EVENT_DATA');
or
//EchoRedux.subscribePrivate(channelName,eventName,actionType);
EchoRedux.subscribePrivate('TestChannel',['TestEvent','TestEvent2'],['ACTION_TEST_EVENT_DATA', 'ACTION_TEST_EVENT2_DATA']);
Leave channel
//EchoRedux.leaveChannel(channel,actionType);
EchoRedux.leaveChannel('TestChannel','ACTION_LEAVE_CHANNEL');
Other
EchoRedux.unsubscribeEvent(channelName,eventName,actionType);
EchoRedux.getChannel(channelName);
EchoReux.getAllChannels();
EchoRedux.getEvents(channelName);