I have a Rails web app that is used to gather data from an iOS device running an app I have developed.
The Rails web server will be handling communication with the Apple Push Notification service, so the iOS app will be sending it the required Device Token and some other application specific data.
The Mac app will be communicating with the Rails app to push a message to an iOS device. Both the Mac app and the Rails web app will be running on the same Mac server, under the same user account.
The communication between the the iPhone and Mac apps and the Rails web app will be done using the RESTful web services exposed by the web app.
Once the iOS app has sent its data to the Rails web service, I need that data to be sent to the Mac App that will be running on the same server as the Rails web app, so that it know which messages need to be pushed and where they should be pushed to.
What should I be looking for if I want to communicate between a Rails web app and a Mac app on the same box?
I have looked into polling the web app from the Mac app via a RESTful service, but I don’t think this is the most elegant or efficient solution. Is there some way that I can invoke some action from the Mac app from Ruby?
Edit:
I’ve just read about NSDistributedNotifications and the the Distributed Notification Center. This sounds like what I’m looking for.
Is it possible to use RubyCocoa from the Rails app to send a distributed notification and have the Mac app listen for this notification?
I think you can make your cocoa app implement a server which listen to a local port like localhost:28888 , and while your rails application receiving data from your iOS app, you can just sent it to localhost:28888