Note that there are some explanatory texts on larger screens.

plurals
  1. POShould I connect directly to CouchDB's socket and pass HTTP requests or use node.js as a proxy?
    text
    copied!<p>First, here's <a href="https://stackoverflow.com/questions/3605115/how-should-i-architect-my-db-api-server-for-a-turn-based-multiplayer-iphone-boa">my original question that spawned all of this</a>.</p> <p>I'm using Appcelerator Titanium to develop an iPhone app (eventually Android too). I'm connecting to CouchDB's port directly by using Titanium's <a href="http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Network.TCPSocket-object.html" rel="nofollow noreferrer">Titanium.Network.TCPSocket object</a>. I <em>believe</em> it utilizes the Apple SDK's CFSocket/NSStream class.</p> <p>Once connected, I simply write:</p> <p><code>'GET /mydb/_changes?filter=app/myfilter&amp;feed=continuous&amp;gameid=4&amp;heartbeat=30000 HTTP/1.1\r\n\r\n'</code> </p> <p>directly to the socket. It keeps it open "forever" and returns JSON data whenever the db is updated and matches the filter and change request. Cool.</p> <p>I'm wondering, is it ok to connect directly to CouchDB's socket like this, or would I be better off opening the socket to node.js instead, and maybe using this <a href="http://github.com/felixge/node-couchdb" rel="nofollow noreferrer">CouchDB node.js module</a> to handle the CouchDB proxy through node.js?</p> <p>My main concern is performance. I just don't have enough experience with CouchDB to know if hitting its socket and passing faux HTTP requests directly is good practice or not. Looking for experience and opinions on any ramifications or alternate suggestions.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload