title: Most effective way to 'listen' for data on a Mac
body: <p>I am currently using a dedicated Mac Mini (OS X Yosemite) to handle mail-merges of Pages (a proprietary format) documents, that is triggered by an Applescript 'Mail-Rule' via incoming push iCloud mail.</p>
  
  <p>However, relying on Mail is proving both inconsistent (will randomly miss some email) and high-latency (can take a long time for push to register even if it is supposed to be instant) — where speed is important.</p>
  
  <p>What I want to achieve is a 'fast-as-possible' receipt of a small amount of data (think a 20-line JSON dictionary) on the Mac, which will then be used to trigger an Applescript action.</p>
  
  <p><strong>Therefore, is there a commonly-accepted / best-practice way of 'listening' for requests that can be sent over the web like this, to OS X?</strong> - i.e. similar to acting as a server implementing a RESTful API / a web-service.</p>
  
  <p>I am literate in primarily front-end and native languages (Obj-C, Swift, JS) but am very open to learning new technologies if there is a neat and simple way of doing this.</p>
  
  <p>My current train of thought is to create a native app that implements a library such as <a href="https://github.com/smyrgl/RESTEasy" rel="nofollow">RESTEasy</a> that will listen and act accordingly — but I was curious if there is a better way of doing this.</p>
  
  <p>And yes, I have to use OS X to get this done (relying on too many proprietary processes).</p>