Added subscriptions final #181
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
All checks were successful
Test before pr merge / test-lint (pull_request) Successful in 7s
This commit is contained in:
@@ -100,7 +100,7 @@ def main():
|
||||
|
||||
schema.mutation.with_mutation("post", PostMutation).with_public()
|
||||
|
||||
schema.subscription.with_subscription("post", PostSubscription)
|
||||
schema.subscription.with_subscription(PostSubscription)
|
||||
|
||||
app.with_auth_root_queries(True)
|
||||
app.with_auth_root_mutations(True)
|
||||
|
||||
@@ -86,15 +86,10 @@ class PostSubscription(Subscription):
|
||||
Subscription.__init__(self)
|
||||
self._bus = bus
|
||||
|
||||
async def post_changed():
|
||||
async for event in await self._bus.subscribe("postChange"):
|
||||
print("Event:", event, type(event))
|
||||
yield event
|
||||
|
||||
def selector(event: Post, info) -> bool:
|
||||
return True
|
||||
return event.id == 101
|
||||
|
||||
self.subscription_field("postChange", PostGraphType, post_changed, selector)
|
||||
self.subscription_field("postChange", PostGraphType, selector).with_public()
|
||||
|
||||
|
||||
class PostMutation(Mutation):
|
||||
|
||||
Reference in New Issue
Block a user