Class GatewayClientInternal

A client for interacting with the Eludris gateway.

Hierarchy

  • GatewayClient

Constructors

  • Create a new gateway client.

    Parameters

    • __namedParameters: {
          emitRawEvents?: boolean;
          logEvents?: boolean;
          rest: RESTClient;
      }
      • Optional emitRawEvents?: boolean
      • Optional logEvents?: boolean
      • rest: RESTClient

    Returns GatewayClient

    Example

    import { GatewayClient, RESTClient } from 'eludris.js';

    // <snip> - Create your REST client and authenticate.

    const gateway = new GatewayClient({
    rest,
    logEvents: true,
    });

    Throws

    If emitRawEvents is false and logEvents is true.

Properties

emitRawEvents: boolean

Whether to emit raw events.

events: TypedEmitter<MessageEvents> = ...

The event emitter. You can listen to events using this.

interval: null | number = null

The interval for sending heartbeats.

The REST client used.

ws: any = null

The WebSocket connection.

Methods

  • Connect to the gateway.

    Returns Promise<void>

    Example

    await gateway.connect();
    

    Throws

    If the client is not authenticated.

  • Parameters

    • heartbeatInterval: number

    Returns Promise<void>

  • Send data to the gateway.

    Parameters

    Returns Promise<void>

    Throws

    If the client is not connected.