npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sodux-child

v0.0.1

Published

Sodux child module to connect with Sodux Mothership

Downloads

5

Readme

Sodux Child

Sodux is a wrapper on web sockets for Node. This goes along with Sodux Mothership here This follows a format similar to Redux to share state between users using web sockets.

Concept

This repository is for Sodux Child, which contains the dispatcher and listener. The Sodux child would connect to the server (Mothership) and starts listening for any changes. Also, the sodux child can dispatch actions to the server so that all other children are informed.

In other words, the child can inform about changes to the mothership and also listen to the hivemind for changes from other children.

In the server, a reducer is used to determine the next state based on the action dispatched by the child.

How to install?

All you have to do is run npm install sodux-child

To import the module to your application

let SoduxChild = require("sodux-child");

How to use?

A Sodux Child instance can be initiated in the WebApp by:

 let soduxChild = new SoduxChild ([URL],[listener],[options]);

URL is the sodux mothership URL Listener is listener function which would listen to any change from the server.

Currently supported options are:

Debug

To log Sodux activities in console

Listener

This is a function which recieves the latest state from the server. This is invoked when the server broadcasts the state on reciving an action from any of the connected children.

The listener can be provided to the Sodux Child either while initiating or by calling the listen method.

soduxChild.listen(newState => {
   console.log("Mothership says ",newState);
})

The newState would contain the latest state of the space the user belongs to. Also, newState.childInfo would contain child related information set using the SET_INFO action.

Multiple listeners can be registered by calling soduxChild.listen multiple times.

Dispatch

This is used to dispatch an action to the server. To dispatch an action,

soduxChild.dispatch({
    type: "CHANGE_SPACE",
    space: "Milky Way"
})

Sodux actions except CONNECTED and DISCONNECTED can be dispatched using soduxChild.dispatch Sodux actions can be checked out here

Note

Currently every dispatch and listen is synchronous.

Also try offloading logic to Sodux mother, since dispatch of an action and calling the listen due to that action is asynchronous. Also try updating variables from listen instead of setting them manually while dispatching (perhaps include loaders to show that data is being processed)