anchor.diff:      {error,_} ->
         %% TODO: change the reply for eg partitioned calls
         {reply, {error,call,RequestId,#{},no_such_procedure}, State}
  -  end;
  -
  -hndl_msg_authed({cancel,RequestId,Options},#state{calls=Calls}=State) ->
  +  end.
  +
  +%%%%%%%%%%%%%%% cancel message %%%%%%%%%%%%%%%%%%%%%%%%%
  +handle_cancel_message(RequestId,Options,#state{calls=Calls}=State) ->
     case lists:keyfind(RequestId,1,Calls) of
       {RequestId,InvocationId} ->
         ok = erwa_invocation:cancel(InvocationId,Options),
  
positive.code:   {send_stop, Message:: term(), #state{} }.
  
  handle_info(Info,State) ->
    case hndl_info(Info,State) of
      {Result, OutMsg, State1} ->
        case Result of
          send_stop ->
            close_session(State1);
          _ -> ok
        end,
        check_out_message(Result, OutMsg, State1);
      {stop,NewState} ->
        close_session(NewState),
        {stop,NewState};
      Other -> Other
    end.
  
  
  -spec check_out_message(atom(), term(), #state{} ) -> {atom(), term(),
                                                              #state{} } |
                                                             {ok, #state{} }.
  check_out_message(Result, Msg,State) ->
    %% case erwa_middleware:validate_out_message(Msg,State) of
    %%   false ->
    %%     {ok,State};
    %%   OutMsg ->
    %%     {Result,OutMsg,State}
    %% end.
    {Result, Msg, State}.
  
  
  hndl_msg({hello,RealmName,Details}, #state{id=SessionId} = State) ->
    AuthId = maps:get(authid, Details, anonymous),
    Roles = maps:get(roles, Details, []),
    case {AuthId == anonymous, erwa_user_db:allow_anonymous(RealmName, tcp)} of 
      {true, true} -> 
        case erwa_sess_man:connect_to(RealmName) of
          ok ->
            %% SessionData = #{authid => anonymous, role => anonymous, session =>
  
negative.code:                 invocation_id = 1,
                  invocations = [],
                  calls = [],
                  client_role = anonymous 
                  }).
  
  
  