Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/francois-esquire/redux.io
Redux binding for Socket.IO
https://github.com/francois-esquire/redux.io
react redux redux-bindings socket-io websocket
Last synced: 25 days ago
JSON representation
Redux binding for Socket.IO
- Host: GitHub
- URL: https://github.com/francois-esquire/redux.io
- Owner: Francois-Esquire
- License: mit
- Created: 2017-02-20T05:58:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T00:41:08.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T08:32:16.593Z (7 months ago)
- Topics: react, redux, redux-bindings, socket-io, websocket
- Language: JavaScript
- Homepage:
- Size: 3.91 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# redux.io
[![npm](https://img.shields.io/npm/v/redux.io.svg)](https://www.npmjs.com/package/redux.io)
[![Build Status](https://travis-ci.org/Francois-Esquire/redux.io.svg?branch=master)](https://travis-ci.org/Francois-Esquire/redux.io)Redux / React binding for Socket.io
**This Is Still Alpha :exclamation:**
Please do not use in production. There are many moving parts missing.
---
## Installation
```bash
npm install redux.io --save
```### Usage
**An Example Can Be Found [Here](examples/README.md)**
This is what comes out of the box:
```javascript
import { reducer, withSocket } from 'redux.io';
// or
const { reducer, withSocket } = require('redux.io');
```**reducer ( io _[, defaultOptions]_ )**
* io (socket.io)
* defaultOptions (Object)It's up to you on how socket.io is delivered to the client.
The only requirement is to pass socket.io to the redux.io reducer as the first parameter.```javascript
import { createStore, combineReducers } from 'redux';import { reducer as socket } from 'redux.io';
/* Get your reference to Socket.io. */
/* Whether you're bundling with the client: */
import io from 'socket.io-client';/* Or if you're having the file served: */
const io = window.io;const rootReducer = combineReducers({
socket: socket(io),
});const store = createStore(rootReducer);
```The complete of options as well as the defaultOptions list can be found [here.](https://github.com/socketio/socket.io-client/blob/master/docs/API.md#new-managerurl-options)
**withSocket ( url _[, options]_ ) ( Component _[, wrapperConfig]_ )**
* url (String)
* options (Object || Function (ownProps))* Component (React element) _optional_
* wrapperConfig (object) _optional_it's worthwhile to explore the socket.io library if you're new to it.
[check it out.](https://github.com/socketio/socket.io-client/blob/master/docs/API.md)---
**TODO:**
* [ ] Complete Test Cases
* [ ] Complete Documentation**History:**
* 0.2.0 - Breaking API changes, HoC Implementation.
* 0.1.0 - Initial Implementation.
**License**
MIT