Documentation Improvement by adding an example and description for initialEvent for custom subscriptions
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 38/100
- Type d'issue
- Documentation
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- graphql, javascript
- Domaine
- api, documentation
Piste de recherche
Commencez par localiser la documentation sur les subscriptions personnalisées ainsi que les exemples existants de @pgSubscription et currentUserTopicFromContext. Documentez initialEvent, notamment sa signature de fonction et l’exemple montré d’établissement de la connexion ; le travail est terminé lorsque les lecteurs peuvent comprendre comment le fournir et ce que contrôle l’objet renvoyé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Over the last few days I've been trying to create a custom subscription that sends the data directly after connecting. However, there is no example in the documentation of an initial event or any evidence that there is an interface for it. The default behavior of an custom subscription is that it only fetches the previous data and the new data (on insert) after an event was been triggered on the database side.
I only got the information about the initialEvent from the discord server:
- By providing the
initialEventargument to@pgSubscription(...)intypeDefsyou can pass to it the function which you want to be executed on connection establishment the same way ascurrentUserTopicFromContextfrom the docs to topic:
currentUserUpdated: UserSubscriptionPayload @pgSubscription(topic: ${embed(
currentUserTopicFromContext,
)})
with initialEvent:
currentUserUpdated: UserSubscriptionPayload @pgSubscription(topic: ${embed(
currentUserTopicFromContext,
)}, initialEvent: ${embed(
onInitialEvent, //the function that you want to be executed
)})
The function that you want to be executed in initialEvent has the same structure as currentUserTopicFromContext:
const onInitialEvent = async (_args, context, _resolveInfo) => {
// do something
return {}; // return an object
}
Now because returning an empty object was the solution for my problem (get already existing data on connection establishment), I didn't dig any deeper on what arguments I can give to the object to control the behavior and what operations can be done in the initialEvent function. This can be added additionally to the documentation.
Adding description for initialEvent and examples for it to the documentation to make it clear that something like that exists would help allot.
- Langage dominant
- SCSS
- Étoiles
- 27
- Forks
- 124
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de graphile/graphile.github.io
-
website: Update details on homepage and sponsor pagePeut-être à nouveau libre @jemgillam l’a pris il y a 1119 jours, et aucune pull request n’est ouverte. Ouvertequick
graphile/graphile.github.io#399 · 4 commentaires · 1 personne assignée ·
-
sponsor page: New wording around Grafast needed!Peut-être à nouveau libre @jemgillam l’a pris il y a 1149 jours, et aucune pull request n’est ouverte. Ouverte
graphile/graphile.github.io#393 · 1 réaction · 1 personne assignée ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 38/100
graphile/graphile.github.io#341 · 1 réaction ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 25/100
graphile/graphile.github.io#280 · 2 commentaires · 5 réactions ·
-
Postgraphile Sandbox/PlaygroundOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
graphile/graphile.github.io#273 · 2 commentaires ·
Toutes les issues de graphile/graphile.github.io
Issues similaires
-
Bug: fenced drafts inside <think> tags break parsing or are returned instead of the answerPeut-être pris @aad1tyaaaaa l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
google/langextract#639 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Niko1221/Strata#7211 · 3 commentaires ·
Les mainteneurs répondent en général sous 5 jours
-
[Bug]: Cannot add sales line item to sales order, on an on-prem installation with basic licenseOuverteTeam: SCM
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
microsoft/BCApps#14569 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
directus/directus#28558 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours