Subscription Chat Application full example does not return message data
alico-cra opened this issue · 2 comments
alico-cra commented
Following the example subscription app provided here: https://github.com/mirumee/ariadne-graphql-chat-example
It appears that the object being yielded back is returning data as null.
The query goes through the resolver as expected and logging the content before it yields contains the correct data.
I am using local memory for communication, and the Broadcast package.
broadcast = Broadcast("memory://")
mutation = MutationType()
@mutation.field("send")
async def resolve_send(*_, **message):
print("Send", message, json.dumps(message))
await broadcast.publish(channel="chatroom", message=json.dumps(message))
return True
subscription = SubscriptionType()
@subscription.source("message")
async def source_message(_, info):
async with broadcast.subscribe(channel="chatroom") as subscriber:
async for event in subscriber:
print("Event", event, event.message)
yield json.loads(event.message)
app = Starlette(
debug=True,
on_startup=[broadcast.connect],
on_shutdown=[broadcast.disconnect],
)
# Mount app to handle GET and POST methods
app.mount("/graphql/", graphql)
# Mount app to handle websocket connections
app.add_websocket_route("/graphql/", graphql)
Is this a GraphiQL issue? Or perhaps an issue with using local memory as opposed to something like redis?
rafalp commented
Hey, thanks for reporting. I'll investigate.
rafalp commented