0
votes

I am working on Ios notification. I am using MQTT with a Mosquitto broker in my project.

I can communicate with my app via mqtt very well if my app on foreground. I want to communicate with my app even if my app is in the background.

So I think push notification is a good solution for this issue. I reviewed raywenderlich's APNS page and I saw APNS needs a server that can communicate APNS for notifcations. I have already a server for my MQTT broker.

Can I use the server also for APNS?

To make it clear, I use MQTT broker and send message for specfic topic. When the message arrived at the broker I want the broker send messages via MQTT and to send APNS according to the topic. Can I do that ?

1

1 Answers

1
votes

Mosquitto does not have a way to add hooks for when messages are published so you can not do this directly from within Mosquitto.

There are 2 options

  1. You could run a client application on the server that subscribes to a suitable wildcard topic and triggers the APN messages.

  2. Some of the other MQTT brokers have support for hooks that allow you to run code within the broker which could be used to send the APN messages. One example would be Mosca which is a javascript MQTT broker.