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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gameglue

v3.0.2

Published

Javascript SDK for the GameGlue developer platform.

Readme

GameGlue SDK

The official JavaScript SDK for GameGlue - build game addons with nothing more than HTML and JavaScript.

What is GameGlue?

GameGlue streams real-time telemetry from PC games to your web applications. The SDK supports bidirectional data flow - receive telemetry updates and send commands back to control the game.

Supported Games:

  • Microsoft Flight Simulator (MSFS)
  • X-Plane 12

Installation

# npm
npm install gameglue

# yarn
yarn add gameglue

Or use the CDN:

<script src="https://unpkg.com/gameglue/dist/gg.umd.js"></script>

Quick Start

import GameGlue from 'gameglue';

const gg = new GameGlue({
  clientId: '<your-client-id>',
  redirect_uri: window.location.origin,
  scopes: ['msfs:read', 'msfs:write']  // or ['xplane:read', 'xplane:write']
});

// Check authentication (handles OAuth callback automatically)
if (!await gg.isAuthenticated()) {
  gg.login();
  return;
}

// Create a listener
const listener = await gg.createListener({
  userId: gg.getUser(),
  gameId: 'msfs'  // or 'xplane'
});

// Receive telemetry
listener.on('update', (evt) => {
  console.log('Altitude:', evt.data.indicated_altitude);
  console.log('Airspeed:', evt.data.airspeed_indicated);
});

// Send commands
await listener.sendCommand('autopilot_on', true);

Getting Started

  1. Sign up at developer.gameglue.gg
  2. Register your application in the Developer Hub
  3. Install the SDK and initialize with your client ID

Telemetry Updates

Subscribe to real-time telemetry with listener.on('update', ...):

listener.on('update', (evt) => {
  // evt.data contains normalized field names (work across all sims)
  console.log('Altitude:', evt.data.indicated_altitude);
  console.log('Heading:', evt.data.heading_indicator);

  // evt.raw contains the original game-specific field names
  console.log('Raw data:', evt.raw);
});

Field Subscriptions

Subscribe to specific fields only (reduces bandwidth):

const listener = await gg.createListener({
  userId: gg.getUser(),
  gameId: 'msfs',
  fields: ['indicated_altitude', 'airspeed_indicated', 'heading_indicator']
});

Manage subscriptions dynamically:

// Add fields
await listener.subscribe(['vertical_speed', 'autopilot_master']);

// Remove fields
await listener.unsubscribe(['heading_indicator']);

// Check current subscriptions
const fields = listener.getFields();  // Returns array or null (all fields)

Note: You cannot unsubscribe if you initialized the listener with all fields (fields: null or omitted). Use subscribe() first to set an explicit field list.

Key Events

Beyond raw telemetry, the SDK provides computed events for significant flight moments:

Landing Events

listener.on('landing', (evt) => {
  console.log(`${evt.quality} landing at ${Math.abs(evt.landing_rate)} fpm`);
  console.log(`Bounces: ${evt.bounce_count}`);
});

Landing quality ratings: butter (<60 fpm), smooth (60-120), normal (120-180), firm (180-300), hard (300-600), crash (>600)

Takeoff Events

listener.on('takeoff', (evt) => {
  console.log(`Rotation at ${evt.rotation_speed} kts`);
  console.log(`Pitch: ${evt.pitch_at_liftoff}°`);
});

Flight Phase Events

listener.on('flight_phase', (evt) => {
  console.log(`Phase: ${evt.previous_phase} → ${evt.phase}`);
});

Phases: parked, taxi_out, takeoff_roll, initial_climb, climb, cruise, descent, approach, final, landing_roll, taxi_in

Sending Commands

Send commands to control the simulator:

const result = await listener.sendCommand('autopilot_on', true);

if (result.status === 'success') {
  console.log('Command sent');
} else {
  console.error('Failed:', result.reason);
}

Commands use normalized names that work across simulators:

// Autopilot
await listener.sendCommand('autopilot_on', true);
await listener.sendCommand('autopilot_heading_hold_on', true);
await listener.sendCommand('set_autopilot_altitude', 35000);

// Gear and Flaps
await listener.sendCommand('gear_toggle', true);
await listener.sendCommand('flaps_down', true);

// Lights
await listener.sendCommand('landing_lights_on', true);
await listener.sendCommand('nav_lights_toggle', true);

See the full command reference for all available commands.

Authentication

// Check if authenticated (handles OAuth callback automatically)
const isAuth = await gg.isAuthenticated();

// Redirect to login
gg.login();

// Get user ID
const userId = gg.getUser();

// Get access token
const token = gg.getAccessToken();

// Logout (clear local tokens only)
gg.logout({ redirect: false });

// Logout and redirect to Keycloak logout
gg.logout();

Scopes

| Scope | Description | |-------|-------------| | msfs:read | Read MSFS telemetry | | msfs:write | Send commands to MSFS | | xplane:read | Read X-Plane telemetry | | xplane:write | Send commands to X-Plane |

API Reference

GameGlue

| Method | Description | |--------|-------------| | new GameGlue(config) | Initialize SDK with clientId, redirect_uri, scopes | | isAuthenticated() | Check auth status. Handles OAuth callback if present. Returns Promise<boolean> | | login() | Redirect to GameGlue login | | logout(options?) | Log out. Pass { redirect: false } to only clear local tokens | | getUser() | Returns authenticated user's ID | | getAccessToken() | Returns current access token | | createListener(config) | Create listener for game telemetry | | onTokenRefreshed(callback) | Register callback for token refresh events |

Listener

| Method | Description | |--------|-------------| | on('update', callback) | Subscribe to telemetry updates | | on('landing', callback) | Subscribe to landing events | | on('takeoff', callback) | Subscribe to takeoff events | | on('flight_phase', callback) | Subscribe to flight phase changes | | sendCommand(command, value) | Send command to simulator | | subscribe(fields) | Add fields to subscription | | unsubscribe(fields) | Remove fields from subscription | | getFields() | Get current subscribed fields (null = all) |

TypeScript

The SDK includes TypeScript definitions:

import GameGlue, {
  LandingEvent,
  TakeoffEvent,
  FlightPhaseEvent,
  UpdateEvent
} from 'gameglue';

listener.on('landing', (evt: LandingEvent) => {
  console.log(evt.quality, evt.landing_rate);
});

listener.on('update', (evt: UpdateEvent) => {
  console.log(evt.data.indicated_altitude);
});

Examples

See the examples/ directory:

  • flight-dashboard.html - Complete flight dashboard with instruments and autopilot control
  • telemetry-validator.html - Developer tool for testing all fields and commands

Documentation

Full documentation at docs.gameglue.gg:

License

MIT