ReduxRTC
Peer 2 Peer connected states using Redux and WebRTC
Table of contents
Installation
npm install redux-rtc -S
Usage
Middleware
const middleware =
Reducer
const rootReducer =
Store
const store =
Create Room
store
Once created the store will contain a token. This token is used in other clients to enter
the room
Enter Room
store
State
const rtc = store
RTC The current state of the ReduxRTC connection
Properties
- token: (string) - The unique identifier for the connection
- room: (object) - The room instance RTCMultiConnection
- streams: (array[VideoElement]) - All of the connected media elements
- loading: false (boolean) - The loading status of the room
- error: 'No Room Found' (string) - Errors will propagate here
Dispatch
By default actions that are dispatched do not propagate to connected clients. To share the actions across all peers the property connected
should be added to the action
var { return type: 'SHARED_BOOLEAN_TRUE' connected: true };var { return type: 'SHARED_BOOLEAN_FALSE' connected: true };var { }
Since the action is denoted as connected, the Middleware
handles posting the message to the connection and the connected peers recieve the action and dispatch to their cooresponding stores.