Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • WebSocketManager

Index

Constructors

Properties

active: boolean
client: PteroClient
shards: Map<string, Shard>
useOrigin: boolean

Accessors

  • get ping(): number

Methods

  • broadcast<T>(event: string, args?: string): Promise<T[]>
  • Broadcasts an event to all shards and waits for the responses.

    example
    const values = await client.ws.broadcast('sendStats');
    console.log(values.map(s => s.resources.uptime));

    Type Parameters

    • T

    Parameters

    • event: string

      The event to broadcast.

    • Optional args: string

      Arguments to send with the event.

    Returns Promise<T[]>

    A list of the returned values, if any.

  • createShard(id: string): Shard
  • deleteShard(id: string): boolean
  • Disconnects a server shard's websocket connection and removes it. If some shards do not return a value, undefined will be set in place.

    Parameters

    • id: string

      The identifier of the server.

    Returns boolean

    Whether the websocket shard was disconnected and/or removed.

  • destroy(): void

Generated using TypeDoc