sdy

create sendMessage(subscribe)

type Subscription {
sendMessage(message: String!): Message!
sendMessage: Message
}
......
import { prisma } from "../../../utils";
import { isAuthenticated, prisma } from "../../../utils";
import { NEW_MESSAGE_TOPIC } from "../../../topics";
export default {
Subscription: {
sendMessage: async (_, args) => {
const { message } = args;
sendMessage: {
subscribe: async (_, __, { request, pubsub }) => {
pubsub.asyncIterator(NEW_MESSAGE_TOPIC);
},
},
},
};
......