This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

redux-cluster-ws

1.4.0 • Public • Published

Redux-Cluster-Ws

Web-socket wrapper to Redux-Cluster library.

npm npm NpmLicense GitHub last commit GitHub release

Install

Please see api for Redux-Cluster

    npm i redux-cluster redux-cluster-ws --save

Add websocket server wrapper and use

require('redux-cluster-ws').server(Test);
Test.createWSServer(<Options>);

Example

require('redux-cluster-ws').server(Test);
Test.createWSServer({
    host: "0.0.0.0", 
    port: 8888, 
    logins:{
        test2:'123456'
    }, 
    ssl:{
        key: /path/to/certificate-key,
        crt: /path/to/certificate,
        ca:	/path/to/certificate-ca
    }
});

require('redux-cluster-ws').server(Test2);
Test2.createWSServer({
    host: "localhost", 
    port: 8889, 
    logins:{
        test2:'123456'
    }
});

Options Required:

  • server - instance of http.Server or https.Server (or use host and port option)
  • host - hostname or ip-address (or use server option)
  • port - port (optional, default 10002, or use server option)
  • logins - login - password pairs as {login1:password1, login2:password2}.
  • ssl - path to server certificate (if use as https, default use http).

Add websocket client library

Client does not use internal Node libraries for webpack compatibility. Therefore, on the client, you must create a store with the same reducer.

//create Redux Store
var ReduxClusterWS = require('redux-cluster-ws').client;
var Test = ReduxClusterWS.createStore(<Reducer>);

//connect to Redux-Cluster server (use socket.io)
Test.createWSClient(<Options>);

Example

var Test = ReduxCluster.createStore(reducer);
Test.createWSClient({host: "https://localhost", port: 8888, login:"test2", password:'123456'});

Options Required:

  • host - hostname or ip-address (protocol include)
  • port - port (optional, default 10002)
  • login - login in websocket
  • password - password in websocket

LICENSE

MIT

Package Sidebar

Install

npm i redux-cluster-ws

Weekly Downloads

0

Version

1.4.0

License

MIT

Unpacked Size

490 kB

Total Files

14

Last publish

Collaborators

  • sergdudko