CouchDB has an http interface that makes it accessible from the server and from the client. Does anything like this exist with a websocket interface?
Thanks in advance for any info!
CouchDB has an http interface that makes it accessible from the server and from the client. Does anything like this exist with a websocket interface?
Thanks in advance for any info!
Share Improve this question edited Jun 19, 2012 at 22:06 fancy asked Jun 19, 2012 at 20:23 fancyfancy 51.6k64 gold badges158 silver badges230 bronze badges 12- 3 I'd remend picking your database on the merits of it doing what you need, not by the connection type it uses for clients. It's easy enough to build such an interface with Node.js or similar. I'm not sure why you would want to though. – Brad Commented Jun 19, 2012 at 20:48
- 2 I assure you the connection will not be the bottleneck – Mustafa Commented Jun 19, 2012 at 21:13
- I never said I was choosing a db based on this. I asked if it existed anywhere. – fancy Commented Jun 19, 2012 at 21:44
- mongodb has a read-only REST interface – jdi Commented Jun 19, 2012 at 21:56
- I think that if it does exist, its going to be a 3rd party library that is specific to a driver of a specific language. The client side javascript aspect would be agnostic enough, but it would have to municate with a server-side process that would then interact with your db – jdi Commented Jun 19, 2012 at 22:00
2 Answers
Reset to default 3In general you don't want to expose your database server directly via a public interface, so there would be a server application in between providing authentication and services like websockets. Typically that would be something like node.js or Tornado .. but since you're aware of that based on your question tags, what is the actual solution you're looking for?
CouchDB currently does not directly support a websocket interface, but the next release (1.3) apparently includes support for the Server Sent Events protocol which is widely supported except for IE (see: browser patibility).
It looks like CouchDB supports EventSource feed type for _changes
:
https://issues.apache/jira/plugins/servlet/mobile#issue/COUCHDB-986
Description
I'll implement EventSource protocol feed for _changes API (feed="eventsource").
Some info about it: http://dev.w3/html5/eventsource/ It's more useful than websocket, beacause it's read-only.
Also: consider https://github./nolanlawson/socket-pouch:
SocketPouch a custom PouchDB adapter that proxies all PouchDB API calls to another PouchDB running on the server in Node.js. The munication mechanism is Engine.io, the famous core of Socket.io.
This means that instead of syncing over HTTP, SocketPouch syncs over WebSockets. Thanks to Engine.io, it falls back to XHR polling in browsers that don't support WebSockets.
PouchDB is a port of CouchDB in JavaScript, meant to run inside the browser (for running a CouchDB database in the browser) or/and Node.js (as a lightweight substitute or plement for CouchDB)