Hi Siegmund, I understand you perfectly, that's just the way I would implement this right now. But think a year or two in the future - when all major browsers (excluding IE of course, but there are fallback-techniques) understand websockets. There will be many use-cases where websockets are superior to ajax and pushing the requests via js-ws to node (also js) to http/rest-couchdb and all the way back will be the way that feels awkward ;)
But my question seems to be answered, there seem to be no plans to support ws in couch in the near future, right? cheers, tobi 2010/2/23 Siegmund Führinger <[email protected]>: > hi! > > i actually use websockets (with node.js) and couchdb in a project of mine. > > but i use websockets only to show the present state and communications > between connected users, as well as notifications of new tickets and so on. > i think this would be awkwardly to implement directly in couchdb (as oposed > to node). > for ordinary couchdb queries, i find the stateless rest approach easier to > handle and scale. > > cheers, > sifu > > On Tue, Feb 23, 2010 at 12:29 PM, Tobias Dühr > <[email protected]>wrote: > >> Actually there's much of a difference between http/ajax/comet and >> websocket. If you're interested here's a nice roundup: >> >> http://www.kaazing.org/confluence/display/KAAZING/WebSockets+versus+Comet+and+Ajax >> >> I was a bit unclear in the example, actually I dream of a js-object >> "CouchDB" with methods like get,put,delete,etc... and also with full >> websocket-functionality. >> >> I see couch often used in a js/ajax-context. But my point is that ajax >> is a hack and websocket is (most probably) the future. >> >> I think it could be a big "selling-point" for couch if this new >> technique is supported. >> >> But I agree with you, it's hard work because websockets work >> differently from http. Nonetheless I think (actually I'm quite sure) >> that there is no way around websockets in the future. >> >> >> 2010/2/23 Andrew Melo <[email protected]>: >> > On Tue, Feb 23, 2010 at 4:34 PM, Tobias Dühr <[email protected]> >> wrote: >> >> Sorry for the confusion. I'll try to explain. >> >> Here is a small js-snipped, mocking up the client part >> >> >> >> if ("WebSocket" in window) { >> >> var ws = new WebSocket("ws://mycouchhost.com/"); >> >> ws.onopen = function() { >> >> ws.send("mydatabase/mydocument/"); // just a (dumb) example! One >> >> would use wrapper functions or json >> > >> > Are you wanting to just GET the document? >> > >> >> }; >> >> ws.onmessage = function (evt) { var received = evt.data; // reply is >> >> a json-object }; >> >> ws.onclose = function() { // websocket is closed. }; >> >> } else { >> >> // the browser doesn't support WebSocket. >> >> } >> >> >> >> So actually I want all the functionality of couchdb, not just for >> >> http, but also for websockets. >> >> >> >> WebSockets have much less overhead than http once the handshake has >> >> been made and they provide server-push functionality. So I think it >> >> could be nice to use them natively in couch. >> > >> > I don't use WebSockets, but it seems like a bunch of work for >> > something that's pretty much already implemented...HTTP shouldn't have >> > much overhead after handshake either, once the headers/responses are >> > sent, it's just a content-length: numbytes and then a dump of the >> > data. Can't get much lower than that. >> > >> >> >> >> 2010/2/23 Jon Gretar Borgthorsson <[email protected]> >> >>> >> >>> I'm a bit confused. >> >>> What would you like to have in the websocket interface? The _changes >> feed? >> >>> >> >>> -- >> >>> Jón Grétar Borgþórsson >> >>> >> >>> On Tue, Feb 23, 2010 at 8:46 AM, Tobias Dühr < >> [email protected]>wrote: >> >>> >> >>> > Hi all, >> >>> > >> >>> > I've wondered if there are any plans to provide a websocket-server >> within >> >>> > couchdb in the future? One option to use this right now would be to >> have an >> >>> > ws-server (e.g.: node.js with websocket [ >> >>> > >> http://devthought.com/blog/2009/12/nodejs-and-the-websocket-protocol/] ) >> >>> > to >> >>> > translate ws to http and back. >> >>> > It would be great if couch could handle ws all by itself. >> >>> > >> >>> > cheers, >> >>> > tobi >> >>> > >> >> >> > >> > >> > >> > -- >> > -- >> > Andrew Melo >> > >> >
