I implemented a subscription for notifications. Even though it works, it doesn't seem to write the published notifications into my redis db. I fear I have an issue with the GlobalContext and how pubSub is used. There might have been an issue with the realtime plugin setup, so I just want to confirm and see what I'm doing wrong. Any help would be appreciated as I've been stuck trying to figure this out and the AI is of no help either.
realtime.ts
import Redis from 'ioredis'
import { RedwoodRealtimeOptions } from '@redwoodjs/realtime'
import subscriptions from 'src/subscriptions/**/*.{js,ts}'
const publishClient = new Redis(process.env.REDIS_URL, {
maxRetriesPerRequest: 2,
db: 1,
})
const subscribeClient = new Redis(process.env.REDIS_URL, {
maxRetriesPerRequest: 2,
db: 1,
})
// This works so I know the connection is set up
publishClient.set("test", "test)
export const realtime: RedwoodRealtimeOptions = {
subscriptions: {
subscriptions,
store: { redis: { publishClient, subscribeClient } },
},
/*
liveQueries: {
//store: 'in-memory',
store: { redis: { publishClient, subscribeClient } },
},
*/
// To enable defer and streaming, set to true.
enableDeferStream: true,
}