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

mumba-wamp

v0.3.1

Published

Client and utilities for connecting to a Web Application Messaging Protocol (WAMP - see http://wamp-proto.org) service.

Downloads

364

Readme

Mumba WAMP

Client and utilities for connecting to a Web Application Messaging Protocol (WAMP) service.

Installation

$ npm install --save mumba-wamp

Configuration

See Autobahn connection options.

Examples

const autobahn = require('autobahn');
import {WampClient} from `mumba-wamp`;

let options = {
	url: 'ws://localhost:8080',
	realm: 'test-realm',
	authid: '*admin',
	authmethods: ['wampcra'],
	onchallenge: (session: any, method: string, extra: any) => autobahn.auth_cra.sign('*password', extra.challenge)
};

// The main test instance.
let instance = new WampClient(options);

instance.onError.subscribe(console.error);

instance.onOpen.subscribe((session: any) => {
	console.log('Connection opened:', session);
	
	instance.closeConnection();
});

instance.onClose((details: any) => {
	console.log('Connection closed:', details);
});

instance.onSubscribe.subscribe(
	(resp: any) => console.log('Subscribed:', resp.topic, resp.id)
);

instance.onRegister.subscribe(
	(result: any) => console.log('Registered:', result.procedure, result.id)
);

instance.openConnection();

Alternate initialisation path if an instance of the WampClient is needed before the connection options are known. For example a login page in a website that needs the user to enter their credentials before opening a socket connection.

import {WampClient} from 'mumba-wamp';

...

const instance = new WampClient();

instance.setOptions(options)
	.openConnection();
...

Caching.

import {WampClient} from 'mumba-wamp';
import {MemoryCache} from 'mumba-cache';

const cache = new MemoryCache({ limit: 100 });
const options = {
  url: 'ws://localhost:8080',
  realm: 'test-realm',
  authid: '*admin',
  authmethods: ['wampcra'],
  onchallenge: (session: any, method: string, extra: any) => autobahn.auth_cra.sign('*password', extra.challenge),
  
  // enable caching
  caching: {
  	enabled: true,
  	
  	// optionally whitelist the proc's to cache
  	includes: []
  }
};

const instance = new WampClient(options);

instance
  .setCache(cache)
  .openConnection();
...

API

WampSession.get

({ authid: '*admin',
  authrole: 'backend',
  authmethod: 'wampcra',
  authprovider: 'static',
  realm: 'test-realm',
  session: 1093244371,
  transport: 
   { type: 'websocket',
     protocol: 'wamp.2.json',
     peer: 'tcp4:127.0.0.1:50979',
     http_headers_received: 
      { connection: 'Upgrade',
        upgrade: 'websocket',
        host: '127.0.0.1:8080',
        'sec-websocket-version': '13',
        'sec-websocket-key': 'MTMtMTQ1MjMxODAyNzA2Mw==',
        'sec-websocket-protocol': 'wamp.2.json',
        'sec-websocket-extensions': 'permessage-deflate; client_max_window_bits' },
     http_headers_sent: {} } })

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm run docker:up
$ npm test
$ npm run docker:down

References

  • http://crossbar.io/docs
  • http://autobahn.ws/js/reference.html

People

The original author of Mumba WAMP is Andrew Eddie.

List of all contributors

License

Apache 2.0


© 2016 Mumba Pty Ltd. All rights reserved.