Search code examples
ruby-on-railsrubypush-notificationxmpplisten

Listen to Prosody Offline messages directory


I have developed a chat application using Prosody and I need to send a push notification when someone receives a message and isn't online.

This chat application works together with my WebApp written in Ruby on Rails.

I searched a lot and didn't found anything that sends push notifications from Prosody(I found for eJabberd but I had another problems with eJabberd). So I decided to look for a gem to RoR that monitors a directory, with that I can monitor the Prosody's offline message directory and get a callback when a message couldn't be delivered to a user and then send a push notification to him.

I found the gem Listen from guard(https://github.com/guard/listen) that do exactly what I need, but I don't know where I should start the listener and when I should stop it since I need it to run aways my WebApp is online.


Solution

  • You are trying to make too over-complicated things, just because you think Prosody is a "black box". In fact you need:

    • prosody module, which "hooks" offline message and send it to your webapp - see example here: https://github.com/JorgenPhi/ProsodyPush

    • push notification module for your favorite web framework - I think you can find tons of ruby gems for it.