sendMessage.js 296 Bytes
import { isAuthenticated, prisma } from "../../../utils";
import { NEW_MESSAGE_TOPIC } from "../../../topics";

export default {
  Subscription: {
    sendMessage: {
      subscribe: async (_, __, { request, pubsub }) => {
        pubsub.asyncIterator(NEW_MESSAGE_TOPIC);
      },
    },
  },
};