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

telclient

v1.0.3

Published

library module for collecting telemetry data

Downloads

13

Readme

Telemetry (Tel) Client

The Telemetry (Tel) Client is a TypeScript library designed for handling telemetry data and communicating it to a server using Socket.io. This library provides various methods for sending different types of telemetry data, making it suitable for game development and other real-time monitoring applications.

Features

  • Send telemetry data of various types to a remote server.
  • Monitor game loops, durations, user-defined events, user input events, game state, entity events, and error events.
  • Establish a Socket.io connection to the server for real-time communication.
  • Keep track of the connection status with the server.

Getting Started

Installation

To use the Telemetry Client in your project, you can install it via npm:

npm install telclient

Usage

Here's a basic example of how to use the Telemetry Client:

import { TelClient, DurationTelData } from "telemetry-client";

const config = {
  serverport: 8080, // Replace with your server's port
  verbose: true, // Enable verbose logging
};

const client = TelClient.create();

// Send a duration telemetry event
const durationData: DurationTelData = {
  label: "MyDurationEvent",
  callback: () => {
    // Your duration event logic here
  },
};

client.durationWithTelemetry(durationData);

// You can use other telemetry methods for different event types.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

Socket.io & UUID

Contact

If you have any questions or need further assistance, feel free to contact the project maintainers:

Mookie @ GameDevShift discord server https://discord.gg/6jSNaJBY

Twitter - @jyoung424242

Itch.io - https://mookie4242.itch.io/

API Documentation

TelClient Class

The TelClient class represents a telemetry client for sending various types of telemetry data to a remote server using Socket.io. This class provides methods for handling game loops, durations, user-defined events, user input events, game state, entity events, and error events.

Table of Contents

Methods

  • create
  • gameLoopWithTelemetry
  • durationWithTelemetry
  • logUserDefinedEventWithTelemetry
  • logUserInputWithTelemetry
  • logGameStateWithTelemetry
  • logEntityEvent
  • logErrorEvent

Methods

create(serverport: number, verbose?: boolean): TelClient

Static method to create a new TelClient instance.

Parameters:

serverport (number): The port number of the Socket.io server. verbose (boolean, optional): Enable verbose logging (default: false). Returns:

TelClient: A new instance of the TelClient class.

Example:

client = TelClient.create(8080, true);

gameLoopWithTelemetry(glCallback: Function): Promise

Logs the start and end of a game loop and sends duration telemetry data.

Parameters:

glCallback (Function): The game loop function to be executed.

Example:

async function gameLoop() {
  // Your game loop logic here
}

await client.gameLoopWithTelemetry(gameLoop);

durationWithTelemetry(data: DurationTelData): Promise

Logs the start and end of a duration event and sends duration telemetry data.

Parameters:

data (DurationTelData): Configuration for the duration event.

Example:

const durationData = {
  label: "DurationEvent",
  callback: async () => {
    // Your duration event logic here
  },
};
await client.durationWithTelemetry(durationData);

logUserDefinedEventWithTelemetry(data: UserDefinedTelData): void

Logs a user-defined event and sends telemetry data.

Parameters:

data (UserDefinedTelData): Configuration for the user-defined event.

Example:

const userData = { label: "UserEvent", payload: ["data1", "data2"] };
client.logUserDefinedEventWithTelemetry(userData);

logUserInputWithTelemetry(data: UserInputTelData): void

Logs a user input event and

sends telemetry data.

Parameters:

data (UserInputTelData): Configuration for the user input event.

Example:

const userInputData = { inputType: "Keyboard", label: "KeyPress", eventName: "KeyA", inputData: ["keyCode", "timestamp"] };
client.logUserInputWithTelemetry(userInputData);

logGameStateWithTelemetry(data: GameStateTelData): void

Logs a game state event and sends telemetry data.

Parameters:

data (GameStateTelData): Configuration for the game state event.

Example:

typescript Copy code const gameStateData = { state: { playerHealth: 100, score: 500 } };
client.logGameStateWithTelemetry(gameStateData);

logEntityEvent(data: EntityEventTelData): void

Logs an entity event and sends telemetry data.

Parameters:

data (EntityEventTelData): Configuration for the entity event.

Example:

const entityEventData = {
  entitydata: { entityID: 1, entityType: "Enemy" },
  eventdata: { action: "Destroy", location: { x: 10, y: 20 } },
};

client.logEntityEvent(entityEventData);

logErrorEvent(data: ErrorEventTelData): void

Logs an error event and sends telemetry data.

Parameters:

data (ErrorEventTelData): Configuration for the error event.

Example:

const errorEventData = { errorMessage: "An error occurred", payload: ["details"] };
client.logErrorEvent(errorEventData);