-
Notifications
You must be signed in to change notification settings - Fork 50
Description
I understand the explanations in the book, but am having difficulty understanding the code in ezwebframe.erl. One problem is the seemingly inconsistency between some of the 'cowboy'-related function calls in ezwebframe and documentation found in the cowboy website. For example:
For websockets, Cowboy website says:
First, the init/3 callback is called. This callback is common to all handlers. To establish a
Websocket connection, this function must return an upgrade tuple.
init(_, Req, Opts) -> {upgrade, protocol, cowboy_websocket}.
or
init(_Type, Req, Opts) -> {upgrade, protocol, cowboy_websocket, Req, Opts}.
But in ezwebframe.erl, I see init/2 with a return tuple of {cowboy_websocket, Req, Pid}, which I can't find anywhere in the Cowboy documentation. Is this from an older version of Cowboy? This is just one example. There are others.
I've successfully used the Yaws web server for a couple of projects in the past. Yaws worked well and unlike Cowboy, it is very well documented. I'm taking a look at Cowboy only because Joe used it in his book, which in my opinion, gave it some credibility. Also, I read somewhere that Cowboy is supposed to be a bit lighter weight and has better performance (maybe because of the use single precess per connection and binaries). But I'm struggling with it; the documentation is terrible.
Curious as to why Joe chose Cowboy over Yaws for his book.