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

simplebroadcast

v0.0.4

Published

Simple broadcasting and repeatign of JSON messages using net sockets

Downloads

15

Readme

SimpleBroadcast

Simple broadcasting of JSON messages using net sockets.

Installation

Via npm on Node:

npm install simplebroadcast

Reference it from your program:

var simplebroadcast = require('simplebroadcast');

Usage

Broadcaster (server) side

var broadcaster = simplebroadcast.createBroadcaster();

broadcaster.listen(8000);

Client side

var client = simplebroadcast.createClient();

client.on('message', function(message) {
    // message processing
});

client.connect(port, host);

// broadcasting a message, after connection
client.on('connect', function() {
    client.write(msg);
}

A broadcaster can connect to another broadcaster. Each one is the cliente of the other.

broadcaster.connect(port, host));

You can build a tree of broacasters. A tree is a graph without cycles. If the graph of broadcasters has a cycle, you messages will be send forever.

A broadcaster can act as a repeater, listening to other repeateres, or connecting as a repeater to another one.

broadcaster.listenRepeater(8001);
broadcaster.connectRepeater(8002, 'repeater2');

The messages sent by a repeater are sent to all clients, but not to other repeaters. The messages sent by a client are sent to the others clients and to all repeaters. In this way, you can build a graph of repeaters, including cycles. Usually it is an star graph were each repeater is connected to all the others.

Development

git clone git://github.com/ajlopez/SimpleBroadcast.git
cd SimpleBroadcast
npm install
npm test

Samples

Broadcast messages to many clients sample shows how you send and receive messages to/from many clients thru a broadcast server.

Versions

  • 0.0.1: Published
  • 0.0.2: Published
  • 0.0.3: Published, updated to use SimpleMessages 0.4. Adding error event to client in code.
  • 0.0.4: Published, updated to use SimpleMessages 0.6

Contribution

Feel free to file issues and submit pull requests � contributions are welcome.

If you submit a pull request, please be sure to add or update corresponding test cases, and ensure that npm test continues to pass.

(Thanks to JSON5 by aseemk. This file is based on that project README.md).