Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including redux-effects-nes with all npm packages installed. Try it out:

require("nes/package.json"); // nes is a peer dependency. var reduxEffectsNes = require("redux-effects-nes")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

redux-effects-nes v1.0.0

Redux effects middleware for Nes

Redux Effects Nes

Downloads Downloads NPM Version Dependencies Dev Dependencies License

Redux effects Nes Middleware


npm i -S redux-effects-nes
yarn add redux-effects-nes



This requires a publish on the Hapi side with a object structured like so. { event: 'eventName', data: {} }

import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
import createSocket from 'redux-effects-nes';
import effects from 'redux-effects';


const middlewareList = [

const enhancer = composeEnhancers(applyMiddleware(...middlewareList));


import { connect, on } from 'redux-effects-nes';


dispatch(connect(socketurl, cb, authHeaders, 'wss'));
dispatch(on('/path', 'eventName', (res) => {
  // Get the res data
dispatch(emit('/path', 'eventName', (res) => {
  // Get the res data
dispatch(emit('someEventName', someDataObject, () => {}));
dispatch(connect(socketurl, cb, authHeaders, 'wss'));

Available methods

  • connect : (socketUrl, callback, headerObject, protocal = 'ws', name = 'default') Used to connect to the socket
  • disconnect : (name = 'default') Used to disconnect from the socket
  • of : (path, name = 'default') Used to create a path event group
  • on : (path, eventName, callback, name = 'default') Used to add a event handler
  • emit : (eventName, dataToSend, callback, name = 'default') Used to send a event back to the server
  • request: (path, callback, options, name = 'default') Used to make a nes request

The name used in connect creates a socket connection assigned to that name. This allows you make multiple connections and reference them.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free