couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Dühr <tobiasdu...@googlemail.com>
Subject Re: Websocket-Server?
Date Tue, 23 Feb 2010 11:29:01 GMT
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 <andrew.melo@gmail.com>:
> On Tue, Feb 23, 2010 at 4:34 PM, Tobias Dühr <tobiasduehr@googlemail.com> 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 <jon.borgthorsson@gmail.com>
>>>
>>> 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 <tobiasduehr@googlemail.com>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
>

Mime
View raw message