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

hubbleiq-services

v2.7.5

Published

HubbleIQ testing SDK

Downloads

98

Readme

HubbleSDK: A JavaScript library to easily measure and analyze internet performance for web applications. Improve user experience by identifying and troubleshooting network issues.

npm


A JavaScript library for measuring and analyzing internet performance.

Getting Started

Note: Node.js versions 18 and above are supported. We recommend using the latest stable version. It is also important for you to obtaining the API key and company key from the HubbleIQ admin panel before using this library.

Installation:

yarn add hubbleiq-services

or

npm install hubbleiq-services

Once installed, you can import the HubbleIQLib component into your React application as follows:

// import the component
import { HubbleIQLib } from "hubbleiq-services";

Configuration

To initialize the HubbleIQ SDK, you need to provide two objects: authData and options. Where authData contains:

{
  apiKey: 'your apiKey',
  companyKey: 'your companyKey'         
}

and options contains additional configuration data. These keys can be obtained from the admin panel after registering on HubbleIQ.

Configuration Options:

| Property Name | Type | Default Value | Description | | ------------- | :----: | ------------: | --------------------------------------------------------------------------------------------------------------------------------------- | | options | object | Not set | Configuration object for the HubbleIQ library, example: { enablePageLoadCalculation: true, checkNetTimeOut: 2000 } |

Examples:

const hubbleIQLib = new HubbleIQLib(
        {
          apiKey: "your apiKey",
          companyKey: "your companyKey"
        },
        options
      );

Usage Examples:

Explore the following code samples that demonstrate how to leverage HubbleIQ SDK’s functionalities within your application:

1. To use the SDK we should first initialize it. Create a file called hubbleIQLib.js:

import { HubbleIQLib } from "hubbleiq-services";

const options = {
  enablePageLoadCalculation: false,
  env: 'local'
};

// construct the library
const hubbleIQLib = new HubbleIQLib (
        {
          apiKey: 'c14aa742-5aac-41cf-abf9-45157df2d3ca',
          companyKey: 'mediumCompanyKey',
        },
        options
);

hubbleIQLib.init();

export default hubbleIQLib;

2. The next step is to create a functions that call the tests from hubbleIQLib:

async function callPocketLossTest() {
  await hubbleIQLib.calculatePacketLoss();
}

async function callInternetConnectionTest() {
  await hubbleIQLib.checkInternetConnection();
}

async function startTest() {
  await hubbleIQLib.run();
}

3. Each SDK method fires an event once the action is finished. We should declare them and save the data we receive from the events into our state using useEffect.

useEffect(() => {
  hubbleIQLib.on("connection-status", (status: string) => {
    // connection status
  });

  hubbleIQLib.on("upload-measurement", (data: IUploadAndDownloadData) => {
    // upload speed: data.ClientToServerSpeed
  });

  hubbleIQLib.on("download-measurement", (data: IUploadAndDownloadData) => {
    // downlod speed: data.ServerToClientSpeed
  });

  hubbleIQLib.on("complete", (data: ICompleteData) => {
    // latency and jitter: data.jitter && data.latency
  });

  hubbleIQLib.on("packet-loss", (data: number) => {
    // packet loss percentage
  });

  hubbleIQLib.on("connection-stability", (data: number) => {
    // heart beat data.
  });
}, []);

Events:

The library emits various events to communicate results. You can listen to these events to handle the data accordingly.

| Event name | Type of response | description | |------------------------| :--------------: | -------------------------------------------------------------------------------: | | onstart | string | Fired when the library starts. Contains the name of the server being contacted. | | complete | object | Emitted after a complete internet performance test is finished. | | connection-status | string | Indicates the current internet connection status (online or offline). | | connection-stability | int | Connection latency (ms). | | connection-msg | object | Provides details about the current connection, including latency. | | upload-measurement | object | Contains results from an upload speed measurement. | | download-measurement | object | Contains results from a download speed measurement. | | test-results | object | Emitted with the complete set of results after a full internet performance test. | | packet-loss | number | Provides the measured packet loss percentage. |

Dependencies:

The HubbleIQ library depends on the following external libraries:

@m-lab/ndt7: used for network speed testing.

crypto-browserify: provides cryptographic functionalities (used for security?).

form-data: used for constructing multipart form data for requests.

node-fetch: enables making HTTP requests in Node.js environments.

stream-browserify: used for handling data streams.

tslib: utility library for compatibility across environments.

web-worker: enables utilizing web workers for background tasks.

worker-plugin: a plugin for handling web workers.

Support:

If you encounter any issues, feel free to contact us by email at [email protected].

Additional Information:

Dependencies: Refer to the documentation for a list of dependencies.

Authors: Hubble Teams

License:

This project uses an API Key Licensing model. You are free to use the functionality provided by the API, but a valid API key is required for access.