Search code examples
ruby-on-railsrubyrestfaye

Ruby REST client publish-subscribe communication possible or not?


I am aware of rails REST interface which allow me to access sources. and I am aware of publish-subscribe strategy for message passing

Is it possible to implement REST client(not browser but ruby client works on arduino device) to access resource if resource (ex. server informed client that resource is now available you can receive) available via publish subscribe strategy ?

I am aware of Faye. is it possible to implement REST client using Faye to receive via publish-subscribe for ruby ? If it is not possible with Faye which can be other solution for Ruby REST client to build a publish subscribe communication ? How can Faye inform ruby client for resource notification ?


Solution

  • REST is based on HTTP, so it is Request-Response. you can't make Pub/Sub service with REST.

    If I were you, I would use Faye to notify client about new resources, or whatever you want to monitor.

    And after notification you can make Ajax request to REST and get new record for example.

    But the best approach is to use Faye for pushing changes to client.

    Don't be aware, it is quite simple.