couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Duehr <tobiasdu...@googlemail.com>
Subject Re: Websocket-Server?
Date Tue, 23 Feb 2010 17:01:36 GMT
Hi,
maybe I was settling on the wrong horse with couch+websockets. For
anyone interested, here's a ws library for node.js that has redis-db
(not as nice as couch, but still) support.

http://github.com/guille/node.websocket.js/

Thank you all for the replies! The whole concept of couch still
appeals to me and I'll keep an eye on the project.

One last thing: WebSockets are not affected by any firewalls.
http://www.websockets.org/about.html


2010/2/23 Siegmund Führinger <sifu@0xx0.net>:
> hi!
>
> On Tue, Feb 23, 2010 at 3:00 PM, Tobias Dühr <tobiasduehr@googlemail.com>wrote:
>
>> 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 ;)
>>
>
> websockets and ordinary http requests serve two different purposes.
> and websockets have the drawback, that you need to keep a connection open,
> which just doesn't scale.
>
>
>
>> But my question seems to be answered, there seem to be no plans to
>> support ws in couch in the near future, right?
>>
>
> i'm not a couchdb contributor. so this is just my personal opinon. not that
> of the couchdb project.
>
> cheers,
> sifu
>
>
>> cheers,
>> tobi
>>
>>
>>
>> 2010/2/23 Siegmund Führinger <sifu@0xx0.net>:
>> > 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 <
>> tobiasduehr@googlemail.com>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 <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