I've been wrecking my brain about this for a few days. I'll run my scenario by you and hopefully you can help me. In my head this is how it goes:I have an Android App.I want my Android App to make (function) calls to a MongoDB database via a Ruby Interface on the Server.e.g. Android app sends a HTTP GET ? with the function name, let's say getFriends for this userRuby Interface receives this request from the app, grabs a thread from a thread pool and calls the appropriate function call implemented in Ruby, to the Mongodb.Ruby Interface gets results from Mongodb and sends a HTML POST to the Android app.So that's how I think it works.I know about the ruby driver for mongo db, and interacting with the mongodb from ruby but, how do I make a ruby back end listen for incoming messages and should these messages be done through sockets or a http interface ala Net::http in ruby?
Android -> Ruby Server Interface -> Mongodb
android;ruby;server;mongodb
I don't see much point in using sockets here - the HTTP protocol should suit your needs just fine. Also, the Ruby server should not send an HTTP POST with the results to the Android app - that's not how HTTP work! The android app sends the POST request to the server, and the Ruby server returns the result as a response, which is part of the HTTP POST sent by the app. Behind the scenes, the Android app opens the TCP socket to send the request and the server uses the same socket to send the response.Anyways, to create a simple HTTP server in Ruby you can use the Rack gem. Alternatively, you can use a full blown Rails web application. Using Rails here is quite an overkill, but most of the setup is done automatically so it might end up easier to setup, and since Ruby on Rails is such a major part of the Ruby culture and influences most of it's ecosystem(enough for many people to confuse RoR with Ruby itself), you can find much more information and support about it online. It might also end up easier to develop due to Rails' automatic reloading mechanism.