0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 13:10:24 +00:00

Switch to Ranch for connection handling

This is the first of many API incompatible changes.

You have been warned.
This commit is contained in:
Loïc Hoguin 2012-08-27 11:50:35 +02:00
parent 50e5a616dc
commit e4124de2c7
35 changed files with 133 additions and 1066 deletions

View file

@ -57,7 +57,7 @@
%% in your <em>cowboy_http_handler:init/3</em> handler function.
-spec upgrade(pid(), module(), any(), #http_req{}) -> closed.
upgrade(ListenerPid, Handler, Opts, Req) ->
cowboy_listener:move_connection(ListenerPid, websocket, self()),
ranch_listener:remove_connection(ListenerPid),
case catch websocket_upgrade(#state{handler=Handler, opts=Opts}, Req) of
{ok, State, Req2} -> handler_init(State, Req2);
{'EXIT', _Reason} -> upgrade_error(Req)