Description

The main client class for interacting with the IVAO API

Hierarchy

Constructors

  • Description

    When constructing the client, you can optionally pass in an options object to set the data refresh rate. The mininum refresh rate is 15 seconds to avoid an IP ban from the IVAO API, and as such the default is also 15 seconds.

    Example

    const client = new IvaoClient();
    // OR
    const client = new IvaoClient({ dataRefreshRate: 30 });

    Parameters

    Returns IvaoClient

Methods

  • Description

    Get all ATC clients connected to the network.

    Example

    const client = new IvaoClient();
    const atcs = client.getIvaoAtcsAll();

    Returns undefined | IAtc[]

  • Description

    Get filtered ATC clients. An optional options object can be passed in to filter the ATCs by any of the keys in the IAtc interface. If no options object is passed, it will behave the same as getIvaoAtcsAll

    Example

    const client = new IvaoClient();
    const atcs = client.getIvaoAtcsFiltered({
    limit: 10,
    atcSession: {
    position: 'GND',
    }
    });

    Parameters

    Returns undefined | IAtc[]

  • Description

    Get all clients connected to the network.

    Example

    const client = new IvaoClient();
    const clients = client.getIvaoClientsAll();

    Returns undefined | IClients

  • Description

    Get clients connected to the network with filtering applied. This can be used to get a specific subset of clients as well as apply limits to the number of clients returned for each subset. An optional options object can be passed with a single key of query which is an array of objects with the following properties: keys and limit.

    If no options object is passed, it will behave the same as getIvaoClientsAll

    Example

    With options object and queries

    const client = new IvaoClient();
    const clients = ivaoClient.getIvaoClientsFiltered({
    query: [
    {
    keys: ['pilots'],
    limit: 3,
    },
    {
    keys: ['observers', 'atcs'],
    },
    ],
    });

    console.log(clients);
    // output: {
    // pilots: [
    // { ... },
    // { ... },
    // { ... },
    // ],
    // observers: [
    // { ... }, total observers
    // ],
    // atcs: [
    // { ... }, total atcs
    // ]
    // }

    Parameters

    Returns undefined | Partial<IClients>

  • Description

    Get connection metadata from the API. This includes the number of clients connected to each server, atc controllers, pilots, etc. An optional options object can be passed in to only return specific keys from the metadata object.

    Example

    Get all metadata

    const client = new IvaoClient();
    const metadata = client.getIvaoConnectionsMetadata();
    console.log(metadata);

    // output: { total: 876, supervisor: 4, atc: 103, observer: 19, pilots: 754, worldTour: 132, followMe: 0 }

    Example

    Get specific keys from metadata

    const client = new IvaoClient();
    const metadata = client.getIvaoConnectionsMetadata({ keys: ['total', 'atc'] });
    console.log(metadata);

    output: { total: 876, atc: 103 }

    Parameters

    Returns undefined | Partial<IConnections>

  • Description

    Gets the entire unprocessed JSON data from the API. This can potentially be a large amount of data depending on network load at the time of request. Only use this if you would like to parse the data yourself, otherwise use the other methods included in the SDK.

    Example

    const client = new IvaoClient();
    const data = client.getIvaoDataRaw();

    Returns undefined | null | IIvaoData

  • Description

    Get all observer clients connected to the network.

    Example

    const observers = client.getIvaoObserversAll();
    

    Returns undefined | IObserver[]

  • Description

    Get filtered observer clients. An optional options object can be passed in to filter the observers by any of the keys in the IObserver interface. If no options object is passed, it will behave the same as getIvaoObserversAll

    Example

    const client = new IvaoClient();
    const observers = client.getIvaoObserversFiltered({
    rating: 3,
    lastTrack: {
    onGround: false,
    }
    });

    Parameters

    Returns undefined | IObserver[]

  • Description

    Get all pilot clients connected to the network.

    Example

    const client = new IvaoClient();
    const pilots = client.getIvaoPilotsAll();

    Returns undefined | IPilot[]

  • Description

    Get filtered pilot clients. An optional options object can be passed in to filter the pilots by any of the keys in the IPilot interface. If no options object is passed, it will behave the same as getIvaoPilotsAll

    Example

    const client = new IvaoClient();
    const pilots = client.getIvaoPilotsFiltered({
    limit: 10,
    lastTrack: {
    onGround: false,
    }
    });

    Parameters

    Returns undefined | IPilot[]

  • Description

    Get all world servers.

    Example

    const client = new IvaoClient();
    const servers = client.getIvaoServersAll();

    Returns undefined | IServer[]

  • Description

    Get filtered world servers. An optional options object can be passed in to filter the servers by any of the keys in the IServer interface. At the time of writing this, only a single world/voice server exists.

    Example

    const client = new IvaoClient();
    const servers = client.getIvaoServersFiltered({
    limit: 10,
    countryId: 'US'
    });

    Parameters

    Returns undefined | IServer[]

  • Description

    Get all voice servers.

    Example

    const client = new IvaoClient();
    const servers = client.getIvaoVoiceServersAll();

    Returns undefined | IServer[]

  • Description

    Get filtered voice servers. An optional options object can be passed in to filter the servers by any of the keys in the IServer interface. At the time of writing this, only a single world/voice server exists.

    Example

    const client = new IvaoClient();
    const servers = client.getIvaoVoiceServersFiltered({
    limit: 10,
    countryId: 'US'
    });

    Parameters

    Returns undefined | IServer[]

  • Description

    Kills the current client instance and clears the data.

    Example

    const client = new IvaoClient();
    client.kill();

    Returns void

  • Description

    Restarts the client instance.

    Example

    const client = new IvaoClient();
    client.restart();

    Returns void

Generated using TypeDoc