CouchDB
  1. CouchDB
  2. COUCHDB-841

Support WebSockets in continuous changes feeds

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Component/s: HTTP Interface
    • Labels:
      None
    • Skill Level:
      Regular Contributors Level (Easy to Medium)

      Description

      Just wanted to put this on the roadmap: it would be nice if continuous changes feeds (and maybe some other things in CouchDB, not sure) could support WebSockets. WebSockets are an emerging standard (there's no final spec yet) with implementations in both recent Chrome and Firefox (beta) releases that allows servers to push information to the browser without having to do polling (or longpolling).

        Activity

        Hide
        Octavian Damiean added a comment -

        I'm also +1 on implementing WebSockets.

        Show
        Octavian Damiean added a comment - I'm also +1 on implementing WebSockets.
        Hide
        Alexander Shorin added a comment -

        Dave Cottlehuber, Benoit Chesneau had share mochiweb patch for websocket support. See the related meeting topic about.

        Show
        Alexander Shorin added a comment - Dave Cottlehuber , Benoit Chesneau had share mochiweb patch for websocket support. See the related meeting topic about.
        Hide
        Dave Cottlehuber added a comment -

        Thoughts on this? I don't see websockets in mochiweb atm, and short of unpick RJ's changes that went into misultin[1], or using an interim shim like mochicow[2] while couchdb migrates to cowboy[3], implementing websockets will be a tricky piece of work.

        Any takers?

        [1]: https://github.com/ostinelli/misultin/blob/master/src/misultin_ws.erl
        [2]: https://github.com/benoitc/mochicow
        [3]: https://github.com/extend/cowboy/tree/master/examples/websocket/src

        Show
        Dave Cottlehuber added a comment - Thoughts on this? I don't see websockets in mochiweb atm, and short of unpick RJ's changes that went into misultin [1] , or using an interim shim like mochicow [2] while couchdb migrates to cowboy [3] , implementing websockets will be a tricky piece of work. Any takers? [1] : https://github.com/ostinelli/misultin/blob/master/src/misultin_ws.erl [2] : https://github.com/benoitc/mochicow [3] : https://github.com/extend/cowboy/tree/master/examples/websocket/src
        Hide
        David Davis added a comment -

        I agree with Nathan. WebSocket support would be nice, but Server Sent Events (SSE) is better suited for the _changes feed. This task is over a year old with no movement. Implementing SSE in couchdb would be very easy. I moved my vote to the #986 task; I suggest others do the same.

        Show
        David Davis added a comment - I agree with Nathan. WebSocket support would be nice, but Server Sent Events (SSE) is better suited for the _changes feed. This task is over a year old with no movement. Implementing SSE in couchdb would be very easy. I moved my vote to the #986 task; I suggest others do the same.
        Hide
        Dirkjan Ochtman added a comment -

        +1. IMO we should probably close this in favor of #986.

        Show
        Dirkjan Ochtman added a comment - +1. IMO we should probably close this in favor of #986.
        Hide
        Nathan Vander Wilt added a comment - - edited

        For those interested in this, I'd recommend tracking the progress of https://issues.apache.org/jira/browse/COUCHDB-986 too (or perhaps: instead).

        Server-sent events are a much better match for CouchDB's (one-way) _changes feed than WebSockets, and are much simpler to implement across the board since they're conceptually just a hybrid of "longpoll" plus the long-lived connection benefits of "continuous" feed types. The EventSource standard, while still a working draft too, has a bit more mature browser support than WebSockets: http://caniuse.com/#feat=eventsource

        Show
        Nathan Vander Wilt added a comment - - edited For those interested in this, I'd recommend tracking the progress of https://issues.apache.org/jira/browse/COUCHDB-986 too (or perhaps: instead). Server-sent events are a much better match for CouchDB's (one-way) _changes feed than WebSockets, and are much simpler to implement across the board since they're conceptually just a hybrid of "longpoll" plus the long-lived connection benefits of "continuous" feed types. The EventSource standard, while still a working draft too, has a bit more mature browser support than WebSockets: http://caniuse.com/#feat=eventsource
        Hide
        Dirkjan Ochtman added a comment -

        I agree that the time to do this probably hasn't exactly arrived yet; it would make more sense to wait until the protocol has been finalized. Which as far as I gather should be close except for the security issue in the recent version. On the other hand, I think the caniuse-report is looking rather promising, with websockets available in all of the modern browsers (Firefox 4, Chrome, Safari, Opera – I don't think we can count IE9 as fully modern yet). We've started using it at work, and it seems to work wonderfully in both Firefox 4 and Chrome (although I had to enable it in Firefox to circumvent the security protection). So I think this would be great to do, but it would make sense to wait until the security bugs have been ironed out of the protocol.

        It would also need someone to step up and make this happen in mochiweb, AFAICT.

        Show
        Dirkjan Ochtman added a comment - I agree that the time to do this probably hasn't exactly arrived yet; it would make more sense to wait until the protocol has been finalized. Which as far as I gather should be close except for the security issue in the recent version. On the other hand, I think the caniuse-report is looking rather promising, with websockets available in all of the modern browsers (Firefox 4, Chrome, Safari, Opera – I don't think we can count IE9 as fully modern yet). We've started using it at work, and it seems to work wonderfully in both Firefox 4 and Chrome (although I had to enable it in Firefox to circumvent the security protection). So I think this would be great to do, but it would make sense to wait until the security bugs have been ironed out of the protocol. It would also need someone to step up and make this happen in mochiweb, AFAICT.
        Hide
        Paul Joseph Davis added a comment -

        Not to be a negative nancy, but I'd be fairly suspect of actually providing websocket support until browser vendors decide that its going to be an actual spec. For instance, the caniuse report [1] is less than exciting. There's also the security issue [2] that's been floating around and to my knowledge has not been addressed by the spec yet. Not to mention there are similar competing specs that do similar things [3].

        [1] http://caniuse.com/#feat=websockets
        [2] http://www.0xdeadbeef.com/weblog/2010/12/disabling-websockets-for-firefox-4/
        [3] http://dev.w3.org/html5/eventsource/

        Show
        Paul Joseph Davis added a comment - Not to be a negative nancy, but I'd be fairly suspect of actually providing websocket support until browser vendors decide that its going to be an actual spec. For instance, the caniuse report [1] is less than exciting. There's also the security issue [2] that's been floating around and to my knowledge has not been addressed by the spec yet. Not to mention there are similar competing specs that do similar things [3] . [1] http://caniuse.com/#feat=websockets [2] http://www.0xdeadbeef.com/weblog/2010/12/disabling-websockets-for-firefox-4/ [3] http://dev.w3.org/html5/eventsource/
        Hide
        kowsik added a comment -

        feed=websocket so existing continuous feed types don't break?

        Show
        kowsik added a comment - feed=websocket so existing continuous feed types don't break?
        Hide
        Matt Parker added a comment -

        This would HUGE. Please, please do this!

        Show
        Matt Parker added a comment - This would HUGE. Please, please do this!
        Hide
        David Davis added a comment -

        This would be a BIG feature for some of us. Let's do it!

        Show
        David Davis added a comment - This would be a BIG feature for some of us. Let's do it!
        Hide
        Dirkjan Ochtman added a comment -

        I should note here, I asked Bob Ippolito (the main author of mochiweb, which is used for CouchDB's http layer) if/when mochiweb growed WebSocket support. He mentioned that someone on github has implemented it, but he will hold off from merging it until someone explicitly asks him to work on that (since he doesn't need WebSocket for his own use cases).

        As for "final spec", I'm not sure there'll be something like a version 1.0, but there'll be a working draft or something that has reached consensus and is implemented in the same way in several different browsers (likely Gecko and Webkit).

        Show
        Dirkjan Ochtman added a comment - I should note here, I asked Bob Ippolito (the main author of mochiweb, which is used for CouchDB's http layer) if/when mochiweb growed WebSocket support. He mentioned that someone on github has implemented it, but he will hold off from merging it until someone explicitly asks him to work on that (since he doesn't need WebSocket for his own use cases). As for "final spec", I'm not sure there'll be something like a version 1.0, but there'll be a working draft or something that has reached consensus and is implemented in the same way in several different browsers (likely Gecko and Webkit).
        Hide
        Tyler Gillies added a comment -

        When is a standard considered final spec? 1.0?

        Show
        Tyler Gillies added a comment - When is a standard considered final spec? 1.0?

          People

          • Assignee:
            Unassigned
            Reporter:
            Dirkjan Ochtman
          • Votes:
            14 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

            • Created:
              Updated:

              Development