anchor.diff:              iorio_stats:listen_connect(Active),
               State = #state{channels=[], iorio_mod=Iorio,
                              iorio_state=IorioState, access=Access, token=Token,
  -                           info=Info1, active=Active},
  +                           info=Info1, active=Active, conn_type=ConnType},
   
               State1 = subscribe_all(Subs, State),
               Req4 = if Active == once -> set_json_response(Req3);
  
positive.code:                                Req).
  
  do_init(Req, Access, Iorio, IorioState, Active) ->
      {Token, Req1} = cowboy_req:qs_val(<<"jwt">>, Req, nil),
      {Params, Req2} = cowboy_req:qs_vals(Req1),
      Req3 = cowboy_req:compact(Req2),
      RawSubs = proplists:get_all_values(<<"s">>, Params),
      Subs = iorio_parse:subscriptions(RawSubs),
  
negative.code:             lager:warning("shutdown listen ~p", [Reason]),
              {shutdown, Req3, #state{}}
      end.
  
  connection_type(Req, once) -> {xhr, Req};
  connection_type(Req, false) -> {post, Req};
  connection_type(Req, true) ->
  	case cowboy_req:header(<<"upgrade">>, Req) of
  		{undefined, Req1} ->
              {sse, Req1};
  		{Bin, Req1} when is_binary(Bin) ->
  			case cowboy_bstr:to_lower(Bin) of
  				<<"websocket">> ->
                      {ws, Req1};
  				_Any ->
                      {unknown, Req}
  			end
  	end.
  