classicborne
    Preparing search index...

    Class BaseHeartbeat

    I send periodic heartbeats to a server list to announce the presence and status of the universe.

    Index

    Constructors

    Properties

    alive: boolean
    pinged: boolean

    If the heartbeat ever had a successful ping. postHeartbeat sets it.

    salt: string
    universe: BaseUniverse
    urlBase: string
    heartbeatRate: number = 45000

    The rate at which to post a heartbeat, in milliseconds.

    heartbeatTimeout: number = 10000

    How long in milliseconds until the heartbeat request times out.

    obviouslyBadStatusCodes: number[] = ...

    Quite notably! This is... still very tailored to ClassiCube... There's this funny issue explaining why it is. Don't build on me, kids! https://github.com/BunnyNabbit/classicborne/issues/33

    This class property is expected to be removed. Actually, maybe the whole heartbeat classes as they are...

    By default, I am 400, 403 and 429. If triggered, postHeartbeat will sleep for rateLimitedDelay.

    rateLimitedDelay: number = 45000

    The delay in milliseconds when bad statuses are received.

    This does not usually happen, if ever. But let's not purposefully retry requests at the rate of retryRate...

    retryRate: number = 1000

    The rate at which to retry posting a heartbeat in case of failure, in milliseconds.

    This is at a lower rate in order to keep my spot at the server list if the server for the server list is having issues. But actually, it tends to be the CDN of the server for the server list that has issues.

    Methods

    • Sends a heartbeat to the server list with the provided form.

      Parameters

      • form: Record<string, string>

      Returns Promise<void>