From: Trans Date: 2009-01-16T21:31:44+09:00 Subject: Re: Desktop <-> Web On Jan 15, 4:39 pm, Brian Candler wrote: > 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. Thanks Brian. Lots of useful info hear. I actually did create web- browser client at first, but the problem is that I needed to save files to the local file system, and that was just too cumbersome with a web-client --it required that I had a local server running too, which added additional headaches. I considered something like Google Gears, Adobe Air, etc. but that ended real quick when I discovered none of them supported 64bit Linux, which I run. (Aside Rant: What the hell is going on with 64 bit support btw? Why the hell are we stuck in 32-bit world? I mean how long has has it bloody been already since 64 CPUs hit the mass-market? It's just intolerable! Honestly, I can't say enough bad things about this state of affairs. It really has to be the pinnacle example of how the whole industry has gone to hell in a hand basket.) So I'm using Shoes on the front-end. And for the most part that's working pretty good so far. T.