MochiWeb - have you used it?

MochiWeb is an Erlang web server that I’ve always been aware of but have never personally used, so I was interested in hearing people experiences of it.

Have you used it? Do you like it?
How does it compare to other web servers such as Cowboy, Elli, and Ace?

4 Likes

I’ll be interested in reading comments too Louis!

I’d especially like to see QUIC/http3 support added. IIRC I think Peter said he wanted to add it to Ace but I haven’t seen him post anywhere for a while (is he still working on that Gleam framework? If so any idea which web server it uses? Ace?)

4 Likes

No, but html_sanitize_ex uses it as a dependency to parse html :slight_smile: Really need to extract that so that not all of mochiweb needs to brought in simply for html parsing.

4 Likes

I used Webmachine for a while, which uses various bits of mochi. It was ok, but when Cowboy became available it left WM in the dust.

2 Likes

The older 0.x versions of Zotonic are running on MochiWeb with (modified) Webmachine.

Nowadays we are using Cowboy with Cowmachine, which is more performant.

Cowmachine [GitHub - zotonic/cowmachine: Webmachine for Zotonic and Cowboy] is a port and optimization of Webmachine to Cowboy, with similar callback functions.

Main differences with Basho’s Webmachine are:

3 Likes

For HTML sanitization you can use the HTML sanitizer in the Zotonic stdlb [GitHub - zotonic/z_stdlib: Zotonic standard function library], check z_html:sanitize/1, /2, and /4 functions.

The sanitizer comes from MochiWeb and is modified to better retain spaces.

4 Likes

It sounds like performance is one of the key reasons Cowboy is more commonly used than MochiWeb. Good to know.

Peter’s playing around with solar energy, type systems, and Gleam JS currently I believe. Very cool.

The core ideas of the Midas framework got merged into the gleam_http library. He was also making a HTTP 1.1 server in Gleam but moved on to other things in the end.

2 Likes

Nice! I’m going to check that out this evening! Specifically neat it for sanitizing html created in markdown.

2 Likes

We also ported the html tokeniser in Mochiweb to javascript to be able to send html snippets to the browser and use it together with Incremental DOM to update the dom-tree.

3 Likes