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

wampa

v0.0.5

Published

Bi-directional, evented, websocketed, JSON RPC. It's kinda like WAMP, but not really.

Downloads

16

Readme

Wampa Build Status NPM

Bi-directional, evented, websocketed, JSON RPC.

It's kinda like WAMP, but not really.

And the name Wampa wasn't taken, so I jumped on it!

(insert pic of me riding a wampa)

The whole thing sits on top of the ws module and provides some sugar and a tiny bit of convenience for the RPC-ish stufff.

Install

npm install wampa

Test

npm test -or- mocha

Usage

###server.js

var Wampa = require('wampa'),
    http = require('http');

var server = http.createServer();

var wampaServer = new Wampa.Server({ server: server, path: '/wampa' });

wampaServer.on('connection', function(socket) {

  // the #Client has exposed some fns to the #Server
  socket.on('expose', function(fns) {
    // run the ping() fn on the #Client
    socket.run.ping('blargh!', 'honk!');
  });

  // handle arbitrary events from the #Client
  socket.on('clientEvent', function(data) {
    console.log('got clientEvent: ', data);
  });

  // expose a fn to the #Client
  socket.expose({
    serveBacon: function() {
      console.log('the client wants bacon!');
    }
  });

});

server.listen(8000);

###client.js

var Wampa = require('../wampa');

var socket = new Wampa.Client('http://localhost:8000/wampa');

socket.on('open', function() {
  console.log('connected');

  // expose #Client fns to the #Server
  socket.expose({
    ping: function(data, datum) {
      // send an event back to the #Server
      socket.sendEvent('clientEvent', 'blargh!')
    },
    pong: function(data) { console.log('pong!', data); }
  });

  // run exposed #Server fns from the #client
  socket.on('expose', function() {
    console.log('server is exposed!');
    socket.run.serveBacon()
  });

});

Events

See https://github.com/einaros/ws/blob/master/doc/ws.md for the details of ws events.

  • Wampa.Server === ws.Server()
  • Wampa.Client === ws()
  • socket.on('expose', function([FnNames]) { });

Methods

  • Socket.expose({}) - Accepts an object of functions to expose to the connected socket.
  • Socket.run.<exposed fn> - Triggers exposed functions on the connected socket.
  • Socket.sendEvent('blargh'[, args ]) - Sends blargh event with optional args to connected socket.

Examples

Look in the examples/ folder to see the good stuff.

Versions

0.0.5

  • Fixed the failing tests

0.0.4

  • Started keeping track
  • Added rudimentary pub/sub