incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Melo <andrew.m...@gmail.com>
Subject Re: Websocket-Server?
Date Tue, 23 Feb 2010 11:09:47 GMT
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