When I think of a web server something like the Apache HTTP server comes to mind - or perhaps something like mod_ruby/Passenger Phusion (which allows you to run Ruby apps on an Apache server) but looking at this thread on EF, Yaws is more like a web framework?
I wonder if anyone who has used Yaws could share their experience?
Perhaps @vinoski (Yaws core team) and @OvermindDL1 (who took part in that thread) could also chime in?
My definition of a web server is a piece of software which implements the HTTP server specification of some version and is able to respond to client requests.
A web framework is a set of libraries and conventions that aid in the development of dynamic web applications. Most web frameworks work with or include an HTTP server of some sort. Of course there is a wide span what constitutes a web framework from micro-frameworks to full-blown ruby on rails style frameworks. The more micro, the closer to just a web server you get.
Yaws is both a web server and a web framework. I think it actually started more like a traditional web server that could serve static content and dynamic content through erlang embedded in html pages (ehtml). Think more like apache/php than phoenix.
It also supports running in embedded mode, where it is part of your OTP application.
By using yaws appmods (an appmod is an erlang module which exports and out/1 function and is registered in config to server a specific URL path) you have full control over the URI Path and can hand off all the processing to your own erlang modules. By using it this way it behaves more like cowboy or elli.
Yaws have lots of features:
websockets / long polling / SSE
json
virtual servers
ehtml, which I guess would be yaws html dialect (it is a html represented as erlang tuples)
session/cookies
webdav
streaming / chunked transfer
and probably a lot more.
I think though, that if you are used to a modern framework yaws may appear a bit archaic. Reading the documentation is like reading a history book over how http has developed over time
You’re correct. Claes, better known as klacke, created Yaws sometime around 2000. To the best of my knowledge, the first commits for it to source control were in January 2001.
Claes is now retired, so I’m the sole caretaker of Yaws. I started contributing to it in 2008.
Interesting - wonder if it could be seen as (or maybe even expanded a little so it’s more like) a ‘micro’ web framework? That could add more potential use-cases even if just by making it easier for people to imagine where/when they might want to use it. (I haven’t actually used a micro framework myself, but know some of them (like Ruby’s Sinatra) are quite popular - hence why it might be worthwhile for Yaws.)
As for the documentation being like an HTTP history book, one reason for this is that Yaws has always evolved based on contributions from people using it. As web technologies advanced over the years, Yaws users would either contribute code to implement new web features or ask us to implement them, and sometimes we implemented features without being asked because we were using them in our own jobs.
Something we’ve always tried hard to do with Yaws is maintain backward compatibility from one release to the next. Seems like changing to a micro framework would go against this notion.
In addition, as @cmkarlsson already noted, Yaws is embeddable, and I’d add to that the fact that it’s reasonably modular – the various features it provides can be used if you want them or ignored if you don’t.
Yeah that sounds about right from what I remember of it’s growth.
It is definitely more low level, has a ton of power, had a few performance issues back in the day (like even before cowboy/mochiweb/etc) but those are likely quite fixed at this point, lol.
I quite enjoyed making the few things in it that I did though, it was pleasant to work in.