0.2.0 • Published 7 years ago

rehub v0.2.0

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

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;