rmapi-js
    Preparing search index...

    Class Notifications

    the account's notifications, read with for await

    Nothing is opened until the first is asked for. A socket that ends is opened again, waiting longer after each failure, and then gives a "reconnected" notification. A refused session rejects with an UnauthorizedError, as does the next read once the client's library signs out, and a socket the account refuses for a reason no retry would change rejects with a ResponseError; iterating again starts over. Leaving the loop, or disposing of it with await using, closes the socket.

    await using notifications = client.notifications();
    for await (const notification of notifications) {
    if (
    notification.kind === "reconnected" ||
    !notification.event.isFrom(client.deviceId)
    ) {
    await library.sync();
    }
    }

    Implements

    Index
    • close the socket and end an iteration that is waiting

      Returns Promise<void>