anchor.diff:        % unsupported
         {shutdown,Req1}
     end.
  -
  -init( Req, _Opts) ->
  -  % need to check for the wamp.2.json or wamp.2.msgpack
  -  Protocols = cowboy_req:parse_header(?SUBPROTHEADER, Req),
  -  lager:debug("protocols are ~p~n",[Protocols]),
  -  case find_supported_protocol(Protocols) of
  -    {Enc,WsEncoding,Header} ->
  -      Req1  = cowboy_req:set_resp_header(?SUBPROTHEADER,Header,Req),
  -      %% Peer = cowboy_req:peer(Req1),
  -      Routing = erwa_routing:init(),
  -      %% Routing1 = erwa_routing:set_peer(Peer,Routing),
  -      %% Routing2 = erwa_routing:set_source(websocket,Routing1),
  -      {cowboy_websocket,Req1,#state{enc=Enc,ws_enc=WsEncoding,routing=Routing}};
  -    _ ->
  -      % unsupported
  -      {shutdown,Req}
  -  end.
  -
  -
   
   websocket_handle({WsEnc, Data}, Req, #state{ws_enc=WsEnc,enc=Enc,buffer=Buffer,routing=Routing}=State) ->
     {MList,NewBuffer} = wamper_protocol:deserialize(<<Buffer/binary, Data/binary>>,Enc),
  
positive.code: websocket_info(_Data, Req, State) ->
    {ok,Req,State}.
  
  terminate(_Reason, _Req, _State) ->
    ok.
  
  
  handle_messages([],ToSend,Routing,_State) ->
    {ok,lists:reverse(ToSend),Routing};
  
negative.code:                routing = undefined
                }).
  
  %% ********************************************************
  %% for cowboy 1.x
  %% ********************************************************
  init(_, Req, _ ) ->
    {upgrade, protocol, cowboy_websocket, Req, []}.
  
  