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

explosion

v0.0.9

Published

WebSocket server for processing service messages mailings

Downloads

2

Readme

explosion

This JS library provides exchange of signaling messages between all client applications.

By implementing proposed

WebSocket server on the basis of which includes the following features:

  • routers (by analogy with the express)
  • lists service messaging
  • controllers access to service messages, mailing lists (It will be sold as an additional module)
  • service messaging filter creation (It will be sold as an additional module)
  • creation of posts on the validity of the test circuit (It will be sold as an additional module)
  • deferred queue service messages, mailings (It will be sold as an additional module)

Browser WebSocket server and clients include the following features:

  • subscription service messaging
  • create your own mailing service messages with the ability to set them right, filters and client handlers (routers)
  • deferred messaging queue (offline mode)

Download this repository

git clone https://github.com/lastuniverse/explosion.git

Install via npm

npm install explosion

for latest unstable version use:

npm install https://github.com/lastuniverse/explosion/tarball/master

Usage

on server side

index.js

let explosion = require( 'explosion' );
let app = explosion( server );
let path = require('path');

// Get all messages send from all clients to "/system/..." distributions
wsapp.use( "/system", function( req, res, next ) {
  // at this point your code
  ...

  let answer = {data: "test"};

  // Resend incomong message to all clients subscribe to "/system" distribution
  res.broadcast();
  // Resend incomong message to sender
  res.send();

  // Send answer message to all clients subscribe to "/system" distribution
  res.broadcast(answer);
  // Send answer message to sender on behalf of the "/system" distribution
  res.send(answer);

  // Send answer message for all clients subscribe to "/you/distribution" distribution
  res.broadcast("/you/delivery", answer);
  // Send answer message to sender on behalf of the "/you/distribution" distribution
  res.send("/you/delivery",answer);

  // Define confirmation of receipt message.
  // It will be sent automatically when the client is waiting for confirmation
  res.confirm = {test: "Your message is ok"}
  
  // allow processing of the next middleware handler
  next();
} );

let yourouter = require('./yourouter');
app.use('/yourouter', yourouter);

// start explosion server
var port = 3000;
server.on( 'request', app );
server.listen( port, function() {
  console.log( 'Listening on ' + server.address().port )
} );

yourouter.js

var explosion = require('explosion');
var router = explosion.Router();

// Get all messages send from all clients to "/system/..." distributions
router.use(function timeLog(req, res, next) {
  // at this point your code
  ...

  // allow processing of the next middleware handler
  next();
});

// Get all messages send from all clients to "/system/templates..." distributions
router.use('/templates', function(req, res) {
  // at this point your code
  ...

  // deny processing of the next middleware handler
  //res.end();
});


module.exports = router;

on client side

index.html

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <script src="js/explosion/explosion.js" type="text/javascript" charset="utf-8"></script>
</head>
<body class="my_body">
</body>

<script type="text/javascript" charset="utf-8">

// download the client part of the explosion
explosion.lib.init({
  url: "http://you.web.server/",
  path: "path/to/explosion/client/scripts",
  prefix: "explosion.",
  postfix: ".js",
  modules: ["host","unique","eventemmiter","messanger"],
  onready: explosionOnReady
});

// if the download was successful ...
function explosionOnReady(){
  // establish a connection to the explosion server
  explosion.lib.messanger.connect({
    url: "http://address.your.explosion.server:port_your_explosion_server",
    onready: messangerOnReady
  });
}

function messangerOnReady(){
  let messanger = explosion.lib.messanger;

  // Get all messages send to you from server "/system" distribution
  messanger.on("/system",function(req){
    console.log("message",req);
  });

  let data = "you message data"; // or {sample: "sample data"}
  
  // Send message to server "/system/template" distribution
  messanger.send("/system/template", data);

  // Send message to the server "/system" distribution with the expectation of an acknowledgment of receipt
  messanger.send("/system", data, function (req){
    console.log("confirm", req);
  });
}

</script>
</html>

Participation in development

https://github.com/lastuniverse/explosion/issues

License

MIT

Important

library development is not yet complete

NPM