A bit off topic, but have you ever considered adding support for something like Socket.IO (adding a TCP handler to support their JavaScript)?  I think it's going to be a while before WebSockets is going to be able to be used across the web and I think Socket.IO is a great bridge until that time comes.<br>

<br><div class="gmail_quote">On Mon, Dec 19, 2011 at 1:39 PM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@dev-extend.eu">essen@dev-extend.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

You can check out my implementation here for Cowboy:<br>
  <a href="https://github.com/extend/cowboy/blob/master/src/cowboy_http_rest.erl" target="_blank">https://github.com/extend/<u></u>cowboy/blob/master/src/cowboy_<u></u>http_rest.erl</a><br>
<br>
Clean straightforward code was one of the big goals of this work. It has few differences with Webmachine, but people have been converting resources from Webmachine to Cowboy without much pain. And Cowboy already had a dispatcher so it was really just a matter of writing the decision code.<br>


<br>
Of course I'm open to any comment you may have about it, good or bad.<div class="im"><br>
<br>
On 12/19/2011 10:34 PM, Andrew Berman wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Ah, yes, I agree we would need a SimpleBridgeBinary and then go the<br>
opposite way if a web server doesn't support binary (binary_to_list).  I<br>
don't think that would be too difficult to implement.  The Webmachine<br>
decision core is the more difficult part   but not too difficult as it<br>
has been implemented in many other languages which might make the<br>
decisioning a bit easier to follow.<br>
<br>
On Mon, Dec 19, 2011 at 1:27 PM, Loïc Hoguin <<a href="mailto:essen@dev-extend.eu" target="_blank">essen@dev-extend.eu</a><br></div><div class="im">
<mailto:<a href="mailto:essen@dev-extend.eu" target="_blank">essen@dev-extend.eu</a>>> wrote:<br>
<br>
    SimpleBridge is nice, but it doesn't solve the OP's issue, which is<br>
    that all the lists are being converted to binary when encoding into<br>
    JSON, so he wants a binary webmachine to avoid converting from lists<br>
    to binary all the time. I believe the implementation added to Cowboy<br>
    recently does what the OP needs. On the other hand it's definitely<br>
    tied to Cowboy and that should be taken into consideration when<br>
    deciding what to use. It's also still considered experimental,<br>
    although I've had good reports so far.<br>
<br>
    Now if there was a SimpleBinaryBridge project it could be more<br>
    suitable for his purpose, but afaik only Cowboy is full binary so<br>
    far (only accepting (io)lists as output data). And of course adding<br>
    Cowboy to SimpleBridge would just be a binary_to_list fest and would<br>
    remove half the advantages of using that server so it's a bit of a<br>
    dead end there.<br>
<br>
<br>
    On 12/19/2011 10:16 PM, Andrew Berman wrote:<br>
<br>
        There was talk on one of the mailing lists about using something<br>
        like<br></div>
        SimpleBridge (<a href="https://github.com/nitrogen/__simple_bridge" target="_blank">https://github.com/nitrogen/_<u></u>_simple_bridge</a><br>
        <<a href="https://github.com/nitrogen/simple_bridge" target="_blank">https://github.com/nitrogen/<u></u>simple_bridge</a>>) so that the use<div class="im"><br>
        of a web server could be independent of Webmachine's logic,<br>
        which IMO is<br>
        the best solution.  I don't think anyone did anything about it,<br>
        but for<br>
        some reason, SimpleBridge has Webmachine support, which doesn't make<br>
        sense logically to me since Webmachine is a toolkit and not a<br>
        web server.<br>
<br>
        I use Webmachine and love what it does for me, but the code<br>
        seems overly<br>
        complicated with a heavy reliance on Mochiweb and uses parameterized<br>
        modules (an unsupported feature of Erlang), so I would actually<br>
        be more<br>
        inclined to start a new project which is influenced by<br>
        Webmachine but<br>
        corrects all the issues with it and makes it a bit more flexible and<br>
        modern (would love for Webmachine to support PATCH for example and<br>
        something like Socket.IO).  I'd be happy to help out with such a<br>
        project<br>
        if anyone is interested in starting one.<br>
<br>
        --Andrew<br>
<br>
        On Mon, Dec 19, 2011 at 12:24 PM, Tristan Sloughter<br>
        <<a href="mailto:tristan.sloughter@gmail.com" target="_blank">tristan.sloughter@gmail.com</a><br>
        <mailto:<a href="mailto:tristan.sloughter@gmail.com" target="_blank">tristan.sloughter@<u></u>gmail.com</a>><br></div>
        <mailto:<a href="mailto:tristan.sloughter@" target="_blank">tristan.sloughter@</a>__<a href="http://gmail.com" target="_blank">gm<u></u>ail.com</a><div class="im"><br>
        <mailto:<a href="mailto:tristan.sloughter@gmail.com" target="_blank">tristan.sloughter@<u></u>gmail.com</a>>>> wrote:<br>
<br>
            Interesting. Sucks that webmachine is so tied to mochi and<br>
        mochi so<br>
            tied to lists, haha. But I'll give this a look.<br>
<br>
            Tristan<br>
<br>
<br>
            On Mon, Dec 19, 2011 at 1:50 PM, Magnus Klaar<br>
        <<a href="mailto:magnus.klaar@gmail.com" target="_blank">magnus.klaar@gmail.com</a> <mailto:<a href="mailto:magnus.klaar@gmail.com" target="_blank">magnus.klaar@gmail.com</a><u></u>><br></div>
        <mailto:<a href="mailto:magnus.klaar@gmail.com" target="_blank">magnus.klaar@gmail.com</a><div class="im"><br>
        <mailto:<a href="mailto:magnus.klaar@gmail.com" target="_blank">magnus.klaar@gmail.com</a><u></u>>__>> wrote:<br>
<br>
                Hi!<br>
<br>
                Cowboy currently includes an experimental webmachine-like<br>
                interface. The first commit of this module should<br>
        explain some<br>
                of the key differences from webmachine. If i remember the<br>
                history of this module the intial estimate for the time<br>
        needed<br>
                to decouple webmachine from mochiweb _and_ refactor<br>
        webmachine<br>
                to support both binaries and lists everywhere was<br>
        greater than<br>
                the time needed to just add the difference between the<br>
        two to<br>
                cowboy.<br>
<br></div>
        <a href="https://github.com/extend/__cowboy/commit/__aab1587a4b3d8f0c3d92a208322752__7d51109980" target="_blank">https://github.com/extend/__<u></u>cowboy/commit/__<u></u>aab1587a4b3d8f0c3d92a208322752<u></u>__7d51109980</a><div class="im">

<br>
        <<a href="https://github.com/extend/cowboy/commit/aab1587a4b3d8f0c3d92a2083227527d51109980" target="_blank">https://github.com/extend/<u></u>cowboy/commit/<u></u>aab1587a4b3d8f0c3d92a208322752<u></u>7d51109980</a>><br>


<br>
                If you're interested in a<br>
<br>
                MVH Magnus<br>
<br>
                On Mon, Dec 19, 2011 at 6:40 PM, Tristan Sloughter<br>
        <<a href="mailto:tristan.sloughter@gmail.com" target="_blank">tristan.sloughter@gmail.com</a> <mailto:<a href="mailto:tristan.sloughter@gmail.com" target="_blank">tristan.sloughter@<u></u>gmail.com</a>><br>

</div>
        <mailto:<a href="mailto:tristan.sloughter@" target="_blank">tristan.sloughter@</a>__<a href="http://gmail.com" target="_blank">gm<u></u>ail.com</a><div class="im"><br>
        <mailto:<a href="mailto:tristan.sloughter@gmail.com" target="_blank">tristan.sloughter@<u></u>gmail.com</a>>>> wrote:<br>
<br>
                    This may be better on a Webmachine questions list. But I<br>
                    thought I'd ask here first since it may be that someone<br>
                    working on one of the other Erlang web servers, besides<br>
                    Mochiweb, has worked on moving Webmachine to use<br>
        that server.<br>
<br>
                    The reason I say that is, Webmachine currently relies on<br>
                    Mochiweb which passes lists instead of binary<br>
        strings for<br>
                    requests. While the req_body of a request is given as a<br>
                    binary the path_info and query string is dealt with as<br>
                    lists. While I would think there could be a<br>
        performance hit<br>
                    due to this my main reason to ask for alternatives<br>
        is that<br>
                    dealing with JSON representations on the backend require<br>
                    converting the lists to binaries for processing<br>
        every time.<br>
<br>
                    There has been<br></div>
        <a href="https://github.com/mochi/__mochiweb/pull/38" target="_blank">https://github.com/mochi/__<u></u>mochiweb/pull/38</a><div class="im"><br>
        <<a href="https://github.com/mochi/mochiweb/pull/38" target="_blank">https://github.com/mochi/<u></u>mochiweb/pull/38</a>> but<br>
                    its clear at the end of the discussion its not a<br>
        change that<br>
                    will be happening to mochiweb anytime soon.<br>
<br>
                    So is there work on Webmachine backed by Cowboy or<br>
        another<br>
                    Erlang web server?<br>
<br>
                    Thanks,<br>
                    Tristan<br>
<br></div>
                    ______________________________<u></u>___________________<div class="im"><br>
                    erlang-questions mailing list<br>
        <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a> <mailto:<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@<u></u>erlang.org</a>><br></div>


        <mailto:<a href="mailto:erlang-questions@" target="_blank">erlang-questions@</a>__<a href="http://erlang.org" target="_blank">erl<u></u>ang.org</a><br>
        <mailto:<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@<u></u>erlang.org</a>>><br>
<br>
        <a href="http://erlang.org/mailman/__listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/__<u></u>listinfo/erlang-questions</a><br>
        <<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a>><br>
<br>
<br>
<br>
<br>
            ______________________________<u></u>___________________<div class="im"><br>
            erlang-questions mailing list<br>
        <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a> <mailto:<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@<u></u>erlang.org</a>><br></div>


        <mailto:<a href="mailto:erlang-questions@" target="_blank">erlang-questions@</a>__<a href="http://erlang.org" target="_blank">erl<u></u>ang.org</a><br>
        <mailto:<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@<u></u>erlang.org</a>>><br>
<br>
        <a href="http://erlang.org/mailman/__listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/__<u></u>listinfo/erlang-questions</a><br>
        <<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a>><br>
<br>
<br>
<br>
<br>
        ______________________________<u></u>___________________<div class="im"><br>
        erlang-questions mailing list<br>
        <a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a> <mailto:<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@<u></u>erlang.org</a>><br></div>


        <a href="http://erlang.org/mailman/__listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/__<u></u>listinfo/erlang-questions</a><div class="im"><br>
        <<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a>><br>
<br>
<br>
<br>
    --<br>
    Loďc Hoguin<br>
    Dev:Extend<br>
<br>
<br>
</div></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<br>
-- <br>
Loïc Hoguin<br>
Dev:Extend<br>
</font></span></blockquote></div><br>