As a headless platform, I believe vendure would greatly benefit from an idiomatic way to register new graphql subscriptions.
This would allow the admin UI to avoid polling and immediately react to data changes.
Some users have managed to get them working #1879 but my personal recent attempts were unfruitful.
What seems to be the approach that is most aligned with vendure's coding standards / architecture would be to use the nest resolver decorators so @Subscription can sit along @Mutation & @Query like in the example below
@Resolver('Entity')
export class EntityResolver {
@Query('entity')
@Transaction()
async entity(@Args('id') id: number) {
...
}
@Mutation('deleteEntity')
@Transaction()
async deleteEntity(@Args('id') id: number) {
...
}
@Subscription('entityDeleted')
async entityDeleted() {
...
}
}
As a headless platform, I believe vendure would greatly benefit from an idiomatic way to register new graphql subscriptions.
This would allow the admin UI to avoid polling and immediately react to data changes.
Some users have managed to get them working #1879 but my personal recent attempts were unfruitful.
What seems to be the approach that is most aligned with vendure's coding standards / architecture would be to use the nest resolver decorators so
@Subscriptioncan sit along@Mutation&@Querylike in the example below