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

@samtec-ash/virtuintestcomm

v0.9.8

Published

Virtuin Test Platform communication utilities for broadcasting, direct, etc communication over RabbitMQ.

Downloads

7

Readme

Virtuin Logo Virtuin Test Comm

Overview

Virtuin Test Comm. provides utilities for broadcasting, direct, etc communication over RabbitMQ.
The following classes are provided:

  • VirtuinTestPublisher: Used by active running test to update status and results to subscribers.

  • VirtuinTestSubscriber: Used by any process wanting to receive test status/result updates.

  • VirtuinTestViewClient: Used by test view (e.g. web-server) to send requests to test view server.

  • VirtuinTestViewServer: Used primarily by active test to listen for view requests.

  • VirtuinTestDispatcher: Used by Virtuin GUI to dispatch tests to a test environment server.

  • VirtuinTestHandler: Used within test environment to handle receiving test start/stop/status/clear requests.
    Not recommended to be used alone. Instead use VirtuinTestServer.

Build

yarn run prepublish

Installation

yarn add @samtec-ash/virtuintestcomm

Examples

VirtuinTestPublisher
import {
  VirtuinTestPublisher
} from '@samtec-hub/virtuintestcomm';

publisher = new VirtuinTestPublisher(
  'DebugStation',
  'DebugTest',
  'DebugUUID'
);

await publisher.open('localhost');
publisher.updateStatus(
  state='STARTING',
  progress=0
);
await publisher.publish(
  message='Just warming up.',
  error=undefined,
  customDict={a=1}
);
publisher.updateStatus(
  state='FINISHED',
  progress=100
);
await publisher.publish(
  message='All done.',
  error=undefined,
  results=[{type='scalar', name='Temp', unit='C', value='28'}],
  customDict={a=2}
);
await publisher.close();
VirtuinTestSubscriber
import {
  VirtuinTestSubscriber
} from '@samtec-hub/virtuintestcomm';

subscriber = new VirtuinTestSubscriber('DebugStation');
await subscriber.open('localhost');
let subscribeTag;
const subscribeCB = async (err, data) => {
  if (err) {
    console.log(`Received error ${err}`);
  } else if (data) {
    if (data.state === 'STARTED') {
      console.log('Test started');
    } else if (data.progress === 100 || data.state === 'FINISHED') {
      console.log('Test finished');
      await subscriber.unsubscribe(subscribeTag);
      await subscriber.close();
    }
  }  
};
subscribeTag = await subscriber.subscribe(subscribeCB);
VirtuinTestViewServer
import {
  VirtuinTestViewServer
} from '@samtec-hub/virtuintestcomm';

viewServer = new VirtuinTestViewServer('DebugStation', 'DebugTest');
await viewServer.open('localhost');

let listenTag;
const listenCB = async (err, data) => {
  if (err) {
    console.log(`Received error ${err}`);
  } else if (data) {
    if (typeof data.operation === 'string') {
      switch(data.operation.toUpperCase()) {
        case 'FOO': {
          console.log('Doing FOO');
          return { success: true, operation: 'FOO' };
        }
        case 'BAR': {
          console.log('Doing BAR');
          return { success: true, operation: 'BAR' };
        }
        case 'EXIT': {          
          setTimeout(() => { viewServer.close(); }, 500);
          return { success: true, operation: 'EXIT' };
        }
        default: {
          console.log('Operation unknown');
          return { success: false };
        }
      }
    }
  }  
};
listenTag = await viewServer.listen(listenCB);
VirtuinTestViewClient
import {
  VirtuinTestViewClient
} from '@samtec-hub/virtuintestcomm';

viewClient = new VirtuinTestViewClient('DebugStation', 'DebugTest');
await viewClient.open('localhost');
viewClient.write({ operation: 'FOO' });
viewClient.close();

API

API HTML
API MD