From: Brian Candler Date: 2009-01-16T06:39:57+09:00 Subject: Re: Desktop <-> Web Aria Stewart wrote: > On Fri, 2009-01-16 at 02:09 +0900, Trans wrote: >> I want to interface a desktop application to a backend web >> application. What's the easiest way to go about this --what's the best >> way to communicate between the two? > > SOAP and XML-RPC are both good options, as is a REST-style interface. > Net::HTTP on the client, whatever on the server. There are APIs on the client side which are higher level than Net::HTTP. * xmlrpc is bundled with Ruby * soap4r (shudder) is bundled with Ruby * ActiveResource is a REST client Which you use typically depends on what the backend application provides. Note that all three use XML, and so are inefficient for large binary transfers, as you have to base64 encode them. If you are writing both front and backend, you could consider other protocols (e.g. DRb). That's harder to scale though, whereas it's easy to set up a HTTP proxy for load-balancing. The above are all synchronous protocols. If asynchronous semantics suit you better (e.g. submit a request, poll for the response later) then you could talk to a queuing system, e.g. * Memcache protocol - Starling * AMQP protocol - various servers inc RabbitMQ * Stomp protocol over HTTP - various servers inc Apache ActiveMQ * ... lots of others Another option is to use XMPP (Jabber) as the transport. There is xmpp4r as endpoint, and a selection of XMPP servers to route your messages through. xmlrpc can run over XMPP. But this is likely to be overkill for a single-server scenario. Finally, consider seriously the possibility of using a plain web browser as the client, using HTML and AJAX over HTTP. It's maybe a bit harder to build an application with a desktop "feel" but it is doable (see Google Docs), and you don't need to distribute any code to the clients. Rails has particularly good support for this, and can generate most of the necessary Javascript for you. However if you're not already a Rails user, there's a steep learning curve to get there. -- Posted via http://www.ruby-forum.com/.