Skip to content
Classhttpv0.12.0

Subscriber

Base class for an HTTP subscriber, binding this.core to the HTTP Core.

abstract class Subscriber<
    KeyOfSubscribers extends SubscriptionKey
> extends Subscriber<KeyOfSubscribers, Core>

Member visibility

Filter class members by access level.

constructor

Constructs a new instance of the Subscriber class

Subscriber(payload: AllSubscriptions[Keys], core: TCore, key: Keys)

Inherited from:Subscriber

Showing members with Protected visibility and higher.

KeyOfSubscribers

The subscription key or keys that this handler receives, the same ones as @Subscribe

KeyOfSubscribers extends SubscriptionKey

core

protected readonly core: TCore

Inherited from:Subscriber

data

The published payload. It's never on a subscriber for several keys, where this.match reads it.

protected data: SingleKeyData<Keys>

Inherited from:Subscriber

key

protected readonly key: Keys

Inherited from:Subscriber

execute()

Executes the subscriber handler logic.

abstract execute(): Promise<void>

Inherited from:Subscriber

match()

Run the case for the published key. Use this only when the subscriber is registered for several keys. On a single-key subscriber, read this.data directly.

Provide one case per registered key. Each case receives that key's own payload. A missing key or an unknown key is a compile error.

protected async match<Ret, Cases>(
    cases: OnlyCases<Cases, SubscriberMatchCases<Keys, Ret>>
): Promise<MatchResult<Ret, Cases>>
Type parameter: Ret

The type that every case must return. Leave it out to get the union of what the cases return.

Throws:

A SeedcordTypeError with MatchCaseMissing when the published key doesn't have a case.

Inherited from:Subscriber