type-graphql#Subscription TypeScript Examples

The following examples show how to use type-graphql#Subscription. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: message-subscriptions.ts    From convoychat with GNU General Public License v3.0 6 votes vote down vote up
@Subscription(returns => Message, {
    topics: CONSTANTS.NEW_MESSAGE,
    filter: filterRoom,
  })
  onNewMessage(
    @Root() message: Message,
    @Arg("roomId") roomId: ObjectID
  ): Message {
    return message;
  }
Example #2
Source File: message-subscriptions.ts    From convoychat with GNU General Public License v3.0 6 votes vote down vote up
@Subscription(returns => Message, {
    topics: CONSTANTS.DELETE_MESSAGE,
    filter: filterRoom,
  })
  onDeleteMessage(
    @Root() message: Message,
    @Arg("roomId") roomId: ObjectID
  ): Message {
    return message;
  }
Example #3
Source File: message-subscriptions.ts    From convoychat with GNU General Public License v3.0 6 votes vote down vote up
@Subscription(returns => Message, {
    topics: CONSTANTS.UPDATE_MESSAGE,
    filter: filterRoom,
  })
  onUpdateMessage(
    @Root() message: Message,
    @Arg("roomId") roomId: ObjectID
  ): Message {
    return message;
  }
Example #4
Source File: notification-subscriptions.ts    From convoychat with GNU General Public License v3.0 6 votes vote down vote up
@Subscription(returns => Notification, {
    topics: CONSTANTS.NEW_NOTIFICATION,
    filter: ({ payload, args, context }) => {
      return payload.receiver.equals(context.currentUser.id);
    },
  })
  onNewNotification(@Root() notification: Notification): Notification {
    return notification;
  }
Example #5
Source File: Firmware.resolver.ts    From ExpressLRS-Configurator with GNU General Public License v3.0 5 votes vote down vote up
@Subscription(() => BuildProgressNotification, {
    topics: [PubSubTopic.BuildProgressNotification],
  })
  buildProgressNotifications(
    @Root() n: BuildProgressNotificationPayload
  ): BuildProgressNotification {
    return new BuildProgressNotification(n.type, n.step, n.message);
  }
Example #6
Source File: Firmware.resolver.ts    From ExpressLRS-Configurator with GNU General Public License v3.0 5 votes vote down vote up
@Subscription(() => BuildLogUpdate, {
    topics: [PubSubTopic.BuildLogsUpdate],
  })
  buildLogUpdates(@Root() u: BuildLogUpdatePayload): BuildLogUpdate {
    return new BuildLogUpdate(u.data);
  }
Example #7
Source File: MulticastDnsMonitor.resolver.ts    From ExpressLRS-Configurator with GNU General Public License v3.0 5 votes vote down vote up
@Subscription(() => MulticastDnsMonitorUpdate, {
    topics: [PubSubTopic.MulticastDnsEvents],
  })
  multicastDnsMonitorUpdates(
    @Root() n: MulticastDnsServicePayload
  ): MulticastDnsMonitorUpdate {
    return new MulticastDnsMonitorUpdate(n.type, n.data);
  }
Example #8
Source File: SerialMonitor.resolver.ts    From ExpressLRS-Configurator with GNU General Public License v3.0 5 votes vote down vote up
@Subscription(() => SerialMonitorLogUpdate, {
    topics: [PubSubTopic.SerialMonitorStream],
  })
  serialMonitorLogs(
    @Root() n: SerialMonitorLogUpdatePayload
  ): SerialMonitorLogUpdate {
    return new SerialMonitorLogUpdate(n.data);
  }
Example #9
Source File: SerialMonitor.resolver.ts    From ExpressLRS-Configurator with GNU General Public License v3.0 5 votes vote down vote up
@Subscription(() => SerialMonitorEvent, {
    topics: [PubSubTopic.SerialMonitorEvents],
  })
  serialMonitorEvents(
    @Root() n: SerialMonitorEventPayload
  ): SerialMonitorEvent {
    return new SerialMonitorEvent(n.type);
  }