I had to write a cowboy stream handler for work this week, and in the process, I put together this little reference module with comments to use as a jumping off point for when I have to write these in the future. Someone pointed out that I should share it online, so here it is! Figured others might find a use for it.
Cowboy, the popular Erlang web server, has deprecated [middleware] and replaced
the concept with [stream handlers], a more flexible, but more complicated API.
This page contains a documented reference implementation of a stream handler, to
help others when developing their stream handlers in the future.
This file has been truncated.
Brilliant! I did something similar a while ago too, but not as diligently commented as yours:
This is excellent. Does someone know if something similar exists for ranch protocol handlers?
Awesome, thanks to both of you guys. Been looking for something like this lately in the cowboy examples. Maybe this would be worth a PR?
There are two
example implementations of
ranch_protocol shipping with
tcp_echo one is very simplicistic,
tcp_reverse is more advanced and implemented as a