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

iowamp

v0.1.2

Published

WAMP™ server in NodeJS

Downloads

18

Readme

iowamp

iowamp is a WAMP™ server in NodeJS. Currently it only supports basic RPC calls, but pub/sub support is coming. It attaches to WebSocket.IO.

License

Apache License (version 2)

Prerequisites

iowamp itselfs requires version 0.6.x of NodeJS or higher. If you want to run the tests, you'll want Vows. To really use iowamp, you will also need WebSocket.IO.

Installing with NPM

npm install iowamp

Attach iowamp to a websocket.io server

Before you can start using iowamp in your project, you need to attach it to an websocket.io instance of your choice:

var iowamp = require('./lib'),
    wsio = require('websocket.io');

var server = wsio.listen(8000);
var app = iowamp.attach(server);

Register a RPC class with methods

Registering a RPC class with some methods is also easy - here is an example for it:

var iowamp = require('./lib'),
    wsio = require('websocket.io');

var server = wsio.listen(8000);
var app = iowamp.attach(server);

app.rpc('http://example.com/calc#', function() {
    this.register('add', function(cb, a, b) {
        cb(null, a + b);
    });
});

The code should be kinda self-explanatory, allthough here is some additional information:

app.rpc(baseURI, constructor) registers a new RPC class

  • baseURI The base URI for the class. It must be a complete URI and it should end with a #. (A CURIE / compact URI is not allowed)
  • constructor Should be a function which registers some RPC methods (will get called in the iowamp scope)

this.register(name, method)

  • name The name of the method. To call the method in a WAMP client, you would need to specifiy the baseURI and the method name like here: http://example.com/calc#add
  • method The method which should be called. The first parameter is always the callback function, followed by the arguments passed from the WAMP client.

cb(error, result) Kinda self-explanatory. If an error will be passed, a generic error will be send back to the WAMP client. If not, the result will be send back.

Catching unknown methods

If you want to catch methods which are unknown / not declared, you can listen for the unknownCall event:

app.on('unknownCall', function(baseURI, method, callback, args...) {
// Your code goes here
});

iowamp NodeJS WAMP™ server - © 2012-2013 P. Mathis ([email protected])