The relationship between the Rails web application and the Mac application

I have a Rails web application that is used to collect data from an iOS device running an application that I developed.

The Rails web server will process communication with the Apple Push Notification service, so the iOS application will send it the required device token and some other data related to specific applications.

The Mac app will interact with the Rails app to send a message to the iOS device. Both the Mac application and the Rails web application will run on the same Mac server under the same user account.

Communication between iPhone and Mac applications and the Rails web application will be made using the RESTful web services provided by the web application.

As soon as the iOS application sends its data to the Rails web service, I need this data to be sent to the Mac application, which will run on the same server as the Rails web application, so that it knows what messages need to be clicked and where they should be clicked.

What do I need to look for if I want to communicate between a Rails web application and a Mac application in the same field?

I looked at a web application survey from a Mac application through a RESTful service, but I don't think this is the most elegant or efficient solution. Is there any way I can invoke some actions from a Mac application from Ruby?

Edit:

I just read about NSDistributedNotificationsand Distributed Notification Center. This is similar to what I'm looking for.

RubyCocoa Rails Mac ?

+3
5

, cocoa , , localhost: 28888, - iOS, localhost: 28888

+2

, , Rails Mac- , /. , - Mac, .

+2

, " ", , .

apis, , .

IPC- , : socket-socket (2), fifo - mkfifo (3), - shmget (2) , mac udp-

udp echo:

http://developer.apple.com/library/mac/#samplecode/UDPEcho/Listings/UDPEcho_m.html#//apple_ref/doc/uid/DTS40009660-UDPEcho_m-DontLinkElementID_5

: mkfifo:

$ mkfifo /tmp/app_communication_fifo
$ echo 'rails app message' > /tmp/app_communication_fifo & #this will block until somebody reads it
[1] 34415
$ cat /tmp/app_communication_fifo
rails app message
[1]+  Done

udp api, , (, , , Mac)

+1
source

I do not think that implementing NSDistributedNotifications will help you. Maybe the basic concept is applicable here. To retrieve data, you need to implement REST-Server on the iPhone. I do not know about the finished API.

Please correct me if I am right!

0
source

Source: https://habr.com/ru/post/1789809/


All Articles