0.4.0 • Published 8 years ago

redux-ipc v0.4.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

redux-ipc

Log your Redux state and actions to a node backend via WebSockets.

Install

$ npm install --save redux-ipc

Demo

Usage

Apply the middleware when creating your Redux store.

const reduxIpcMiddleware = require('redux-ipc');

const state = {
  todos: [],
};

// apply the middleware
const store = createStore(state, {}, applyMiddleware(reduxIpcMiddleware));

// dispatch actions
// store.dispatch(...);
// store.dispatch(...);
// store.dispatch(...);

Create the server to listen for messages.

const Server = require('redux-ipc').Server;

const PORT = process.env.REDUX_IPC_PORT || 8080;
const PROTOCOL = process.env.REDUX_IPC_PROTOCOL || 'redux-ipc';

// create a new redux ipc server
const wss = new Server({ port: PORT, socketName: PROTOCOL });

// listen to messages
wss.on('message', message => {
  console.log(message);
});

Examples

Run npm install and npm start for each directory in /examples.

Note: Examples are based on the official Redux examples with slight modifications to showcase the IPC functionality.

License

MIT © Vu Tran

0.4.0

8 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.0

8 years ago