Hi @jdrorrer and thanks for trying our Redwood Realtime and GraphQL subscriptions.
I just setup a new project and following the doc instructions here: Realtime | RedwoodJS Docs
yarn create redwood-app --ts rw-sub-example
cd rw-sub-example
yarn
yarn rw setup server-file
yarn rw setup realtime
I elected to install the default examples.
I also setup realtime in the GraphQL handler:
import { createGraphQLHandler } from '@redwoodjs/graphql-server'
import directives from 'src/directives/**/*.{js,ts}'
import sdls from 'src/graphql/**/*.sdl.{js,ts}'
import services from 'src/services/**/*.{js,ts}'
import { db } from 'src/lib/db'
import { logger } from 'src/lib/logger'
import { realtime } from 'src/lib/realtime'
export const handler = createGraphQLHandler({
loggerConfig: { logger, options: {} },
directives,
sdls,
services,
realtime,
onException: () => {
// Disconnect from your database with an unhandled exception.
db.$disconnect()
},
})
I then launched dev:
yarn rw dev
And then GraphQL Playground to subscribe to room 1 messages:
And then sent a message
which I received:
The server file that the setup creates is:
import { createServer } from '@redwoodjs/api-server'
import { logger } from 'src/lib/logger'
async function main() {
const server = await createServer({
logger,
})
await server.start()
}
main()
I see that the examples I made last September or so (7 months ago) in are old … and
Please see our showcase realtime app for examples of subscriptions and live queries. It also demonstrates how you can handle streaming responses, like those used by OpenAI chat completions.
in the docs should make a note of that.
Could you try the setup commands above and see if the server file you then get is more what you need?