-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Configure Redwood Realtime in GraphQL Yoga #8397
feature: Configure Redwood Realtime in GraphQL Yoga #8397
Conversation
fd1449f
to
05fead0
Compare
@@ -20,6 +20,11 @@ export const generateGraphQLSchema = async () => { | |||
'subscriptions/**/*.{js,ts}': {}, | |||
} | |||
|
|||
// If we are serverful, we need to include the live directive for realtime support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jtoar It would be nice to have a convenience method to know if one is "server" capable or not.
It helps here because I know to add the live query directive to the schema, since it is only really possible when realtime is possible.
It could help also with the Inngest plugin codemod to know if the GraphQL config should be modified in the handler function or in the server file declaration to create Yoga.
Could there be a a config toml setting the the server file? And then something there to see if "serverful"?
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I move this as a convenience function in project-config?
packages/graphql-server/src/plugins/__tests__/__snapshots__/useRedwoodRealtime.test.ts.snap
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally with @dthyresson and it worked great. There's some discussion to have around config values and the best place for them to live but that shouldn't block this just now.
2c84d4a
to
bdb7d05
Compare
Co-authored-by: Josh GM Walker <[email protected]>
bdb7d05
to
fc0cf00
Compare
* Implement useRedwoodLiveQuery * Test useRedwoodLiveQuery * Rename to Realtime, add pub sub * Handle RedwoodRealtimeOptions and auto allow subs if ok * Refactor for realtime yoga config * Document realtime types * Apply suggestions from code review * Fix yarn.lock * Changes PubSub type * include the live directive for realtime support * Adds realtime graphql schema test case for live query directive * Ensure live query actually added to schema (just once) * Remove stray console.debug * yarn dedupe * Update test snapshot * Update packages/graphql-server/src/createGraphQLYoga.ts Co-authored-by: Josh GM Walker <[email protected]> * Improved the should update schema with live directive test --------- Co-authored-by: Josh GM Walker <[email protected]>
Hey guys, does this feature add to the latest release 5.2.4? I really need GraphQL Subscription for realtime data query with OpenAI stream completion |
Hi @steveoon No, this is not in 5.2.4 but is in canary. That said, this PR is just one milestone of a much longer roadmap https://www.notion.so/redwoodjs/Public-Roadmap-6ade052af6414aca897cfd0bf3ae0641?pvs=4 for Realtime. I don't think the milestones are publicly available, but still to come are:
The goal for realtime is to have it in v6 and we'll have updates along the way. When the auth and serverful deploy items are sorted out, I hope to have this in a release candidate for people to try. It won't be long and we'll make an announcement -- so it's coming, but just not ready to try out at the moment. Thanks for your interest -- it's a long coming and exciting new feature! |
Hi @dthyresson , Thanks for your reply~ I'm very exciting about this feature, I believe we have lots of Redwood JS fans who need it. I've been paying attention at Redwood since 2019 and really love it, now I use it to develop AI products, the DX is fantastic! I'm really looking forward to getting this in v6 as soon as possible, and maybe it takes a best-practice example to interact with OpenAI 😄 |
This PR:
will need the pubSub and liveQueryStore say from
and then can use the store and pubSub
or
OUT OF DATE: I did figure out a way to add the directive in the schema generation, but see comment below about detecting if a project is "serverful" or can "support realtime".
Note: The one outstanding issue is that the
@live
directive is not generated when generated the graphql schema and types.I may be able to solve this with a
setup realtime
that adds the sdl:This issue is that the recommended approach is to do: