1.4.0 • Published 4 years ago

redux-cluster-ws v1.4.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

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

1.4.0

4 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.1

5 years ago