JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 68
  • Score
    100M100P100Q76262F
  • License Apache-2.0

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

Package Exports

  • mumba-wamp

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mumba-wamp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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) => {
        return autobahn.auth_cra.sign('*password', extra.challenge);
    }
};

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

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),
    console.error
);

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

instance.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 test

References

People

The original author of Mumba WAMP is Andrew Eddie.

License

Apache 2.0


© 2016 Mumba Pty Ltd. All rights reserved.