JSPM

atc24-client

1.1.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 4
    • Score
      100M100P100Q37785F
    • License MIT

    A Javascript wrapper for the 24data API

    Package Exports

    • atc24-client

    Readme

    ATC24 Client

    A Javascript wrapper for the 24data API.

    Features

    • REST API access to aircraft and controller data
    • WebSocket support for live updates
    • Optional caching of REST responses
    • Optional WebSocket auto-reconnect
    • Lightweight, production-ready

    Installation

    npm install atc24-client

    Basic Usage

    const Data24 = require('atc24-client');
    const client = new Data24({ cache: true, autoReconnect: true });
    
    client.on('connected', () => console.log('WebSocket connected!'));
    client.on('ACFT_DATA', (data) => console.log('Live aircraft data:', data));
    
    (async () => {
        const aircraft = await client.getAircraftData();
        console.log(aircraft);
        client.connectWebSocket();
    })();

    API Reference

    Class: Data24(options)

    Options

    • cache (boolean) — Enable caching of REST data.
    • cacheDuration (number) — Cache duration in milliseconds.
    • autoReconnect (boolean) — Automatically reconnect WebSocket if disconnected.
    • reconnectInterval (number) — Reconnect interval in milliseconds.

    Methods

    • getAircraftData() — Get aircraft data.
    • getEventAircraftData() — Get event aircraft.
    • getControllers() — Get controller data.
    • connectWebSocket() — Start WebSocket connection.
    • disconnectWebSocket() — Disconnect WebSocket.
    • on(event, callback) — Listen for WebSocket events.
    • destroy() — Cleanup and reset instance.

    Events

    • connected — Fired when WebSocket connects.
    • disconnected — Fired when WebSocket disconnects.
    • error — Fired on WebSocket error.
    • ACFT_DATA, CONTROLLER_DATA, etc — Live data events.