anchor.diff:  handle_cast(_Request, State) ->
   	{noreply, State}.
   
  +internal_yield(State,RequestId,Details,Arguments,ArgumentsKw) ->
  +  RouterPid = self(),
  +  {ok} = dequeue_procedure_call(RouterPid,RequestId,Details,Arguments,ArgumentsKw,undefined,State),
  +  ok.
  +
  +internal_error(State,RequestId,Arguments,ArgumentsKw,Error) ->
  +  RouterPid = self(),
  +  {ok} = dequeue_procedure_call(RouterPid,RequestId,[],Arguments,ArgumentsKw,Error,State),
  +  ok.
  +
   handle_info({'DOWN',Ref,process,_Pid,_Reason},State) ->
     remove_session_with_ref(Ref,State),
     {noreply,State};
  +
  +handle_info({erwa,{invocation,RequestId,RpcId,_Details,Arguments,_ArgumentsKw}},
  +            State = #state{ internal_rpc_map = InternalRpcMap }) ->
  +  NewState =
  +    case proplists:get_value(RpcId, InternalRpcMap) of
  +      undefined ->
  +        %% this should never happen.
  +        io:format("~nerror: Unexpected state, called an undefined router-side RPC"),
  +        ok = internal_error(State,RequestId, undefined, undefined, no_such_procedure),
  +        State;
  +      Fun ->
  +        {Res, State0} = Fun({args, Arguments}, State),
  +        ok = internal_yield(State0, RequestId, [], [Res], undefined),
  +        State0
  +    end,
  +  {noreply, NewState};
  +
   handle_info(_Info, State) ->
  -	{noreply, State}.
  +  {noreply, State}.
   
   terminate(_Reason, _State) ->
   	ok.
  
positive.code:   end,
    send_message_to(shutdown,Pid);
  
  handle_wamp_message({publish,RequestId,Options,Topic,Arguments,ArgumentsKw},Pid,#state{mw=MW}=State) ->
    Session = disconnect_unauth(Pid, State),
    case MW:perm_publish(Session#session.id,Options,Topic,Arguments,ArgumentsKw) of
      true ->
        {ok,_PublicationId} = send_event_to_topic(Pid,Options,Topic,Arguments,ArgumentsKw,State),
        % TODO: send a reply if asked for ...
        ok;
  
negative.code:                                                     ]}]}]}]).
  
  
  -define(INTERNAL_RPCS,
          [ {<<"wamp.reflection.procedure.list">>,
             fun reflection_procedure_list/2
            },
            {<<"wamp.reflection.topic.list">>,
             fun reflection_topic_list/2
            }
          ]
  ).
  
  -record(state, {
    realm = undefined,
    ets = undefined,
    version = undefined,
    mw = erwa_mw_default,
    internal_rpc_map = []
  }).
  
  -record(session, {
  