rehub

0.2.0 • Public • Published

rehub

A Redux middleware to share actions via WebRTC

Usage

Client

// store.js
import { createStore, applyMiddleware } from 'redux';
import rehub from 'rehub';
import reducers from './reducers';
 
export default applyMiddleware(rehub({
  signaling: 'ws://localhost:9000', // this is your signaling server, see below
  action: [
    'ADD_CLICK' // these actions will be shared across all peers
  ],
}))(createStore)(reducers);

Server

const express = require('express');
const http = require('http');
const getSignalingServer = require('rehub/server');
 
const app = express();
 
const server = http.createServer(app);
getSignalingServer({ server });
 
module.exports = app;

Package Sidebar

Install

npm i rehub

Weekly Downloads

1

Version

0.2.0

License

MIT

Last publish

Collaborators

  • oakfang