Hey Guys!
I think, there is a big issue in the subscription filtering.
I checked this page(https://www.prisma.io/docs/prisma-client/features/realtime-JAVASCRIPT-rsc8/i), and tried to create the endpoint to subscribe to a room. only when a new message is posted on the room, the subscription endpoint returns the message, but I got nothing from it.
when I changed { mutation_in: ['CREATED'], roomID_contains: args.roomID } to { mutation_in: ['CREATED'] }, it returns every message from any room.
if someone help me, I really appreciate that.
My code is something like that
function newMessageEvent (parent, args, context, info) {
return context.prisma.$subscribe.message({ mutation_in: ['CREATED'], roomID_contains: args.roomID }).node()
}
const messageChanged = {
subscribe: newMessageEvent,
resolve: payload => {
console.log(payload)
return payload
},
}
module.exports = {
messageChanged,
}
Thanks
It's not documented, but try:
return context.prisma.$subscribe
.message({
mutation_in: ['CREATED'],
node: {
roomID_contains: args.roomID,
},
})
.node()
Yes, the solution @joshhopkins suggested here is the way to go.
@nikolasburk Can we please add this to our docs.
@joshhopkins Thanks a lot!!
It actually works!
Most helpful comment
It's not documented, but try: