graphql-lambda-subscriptions / SubscribeOptions
| Name | Type |
|---|---|
T |
extends PubSubEvent |
TSubscribeArgs |
extends SubscribeArgs = SubscribeArgs |
• Optional filter: SubscriptionFilter<TSubscribeArgs, T["payload"]>
An object or a function that returns an object that will be matched against the payload of a published event. If the payload's field equals the filter the subscription will receive the event. If the payload is missing the filter's field the subscription will receive the event.
• Optional onAfterSubscribe: (...args: TSubscribeArgs) => MaybePromise<void>
▸ (...args): MaybePromise<void>
Gets resolver arguments to perform work after a subscription saved. This is useful for sending out initial events.
| Name | Type |
|---|---|
...args |
TSubscribeArgs |
MaybePromise<void>
• Optional onComplete: (...args: TSubscribeArgs) => MaybePromise<void>
▸ (...args): MaybePromise<void>
Called at least once. Gets resolver arguments to perform work after a subscription has ended. This is useful for bookkeeping or logging. This callback will fire
If the client disconnects, sends a complete message, or the server sends a complete message via the pub/sub system. Because of the nature of aws lambda, it's possible for a client to send a "complete" message immediately disconnect and have those events execute on lambda out of order. Which why this function can be called up to twice.
| Name | Type |
|---|---|
...args |
TSubscribeArgs |
MaybePromise<void>
• Optional onSubscribe: (...args: TSubscribeArgs) => MaybePromise<void | GraphQLError[]>
▸ (...args): MaybePromise<void | GraphQLError[]>
Gets resolver arguments to perform work before a subscription is allowed. This is useful for checking arguments or validating permissions. Return an array of GraphqlErrors if you don't want the subscription to subscribe.
| Name | Type |
|---|---|
...args |
TSubscribeArgs |
MaybePromise<void | GraphQLError[]>