1

The point of this is to create 100 topics from a list. When this is done my application will go through this list once every day to check for upcoming events. A message will be sent to the subscribed users if the app finds an event on a particular topic. I will also try to implement some logic to check if there are users subscribed to this particular topic.

adjuremods
  • 2,938
  • 2
  • 12
  • 17
Jan Bildus
  • 57
  • 6
  • There is no explicit API to create a topic. Topics are automatically created when a user subscribes to them or when you send a message to them. – Frank van Puffelen Nov 15 '16 at 15:49

2 Answers2

1

Two parts to your question:

Firebase topic subscription is officially documented only for devices. In other words, only devices with device tokens can subscribe to a topic. Look at AWS SNS topics for topics on which other applications can subscribe.

Secondly, for your use case, topics may not be the solution. Generally, a topic is not like a queue from which you can retrieve a message. Generally, a topic will only send messages to subscribers already actively subscribed to the topic. If there is no subscriber on the topic when a message is received, the message disappears.

Akber Choudhry
  • 1,755
  • 16
  • 24
  • Thank you for the explanation. I will take a look at how I can solve this with AWS SNS API. – Jan Bildus Nov 15 '16 at 11:48
  • AWS SNS allows lambda functions, among other types of subscribers, to subscribe to a topic. You can then do whatever you want with the message contained within the SNSEvent passed to the lambda function. For example, you can write it to a DB. – Akber Choudhry Nov 15 '16 at 12:57
0

AFAIK, I don't think this is possible. The way I understand how Topics work is that (from my answer here, also mentioned it in my answer here):

a topic is created when there is at least 1 subscriber and it also gets automatically deleted when there are no more subscribers.

Regardless if it's for web-app or mobile app, having a registration token is necessary for Topic Messaging.

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281
  • I really like the simplicity of the fcm topics and was hoping for a simple solution to this problem, but thank you for the response. – Jan Bildus Nov 15 '16 at 11:48