Kemal is a Fast, Effective, Simple web framework written in Crystal.

Hello everyone,

Kemal 0.21.0 is here This release brings long wanted features with more performance

WebSocket Context

A long wanted feature, allows one to use HTTP::Server::Context in ws declarations This would allow accessing named url parameters and query parameters in WebSocket routes.

For example consider having a WebSocket url like

ws://myawesome.site/kemal?username=sdogruyol

Now you can access these variables from your url within your ws route

ws "/:room_name" do | socket , env | env . params . url [ "room_name" ] # => kemal env . params . query [ "username" ] # => sdogruyol end

Customizable Static File Headers

Another long wanted feature, which adds support for customizing the headers of built-in Kemal::StaticFileHandler Useful for single page applications which rely on CORS .

Here’s a quick snippet for allowing CORS on .js files.

static_headers do | response , filepath , filestat | if filepath =~ /\.js$/ response . headers . add ( "Access-Control-Allow-Origin" , "*" ) end end end

More Performance

Kemal is built for being fast, we take performance seriously. In recent benchmarks we discovered that Kemal is being blazing fast

However, that’s not a reason to stop us from getting faster This release brings %10-%15 performance increase in overall execution times.

Thanks for using and supporting Kemal. You can check the full CHANGELOG here.

P.S: You can support Kemal development via Patreon

Happy Crystalling