anchor.diff:      true ->
         Ets = ets:new(erwa_router,[?TABLE_ACCESS,set,{keypos,2}]),
         Version = erwa:get_version(),
  -      {ok,#state{realm=Realm,ets=Ets,version=Version,mw=Middleware}}
  -  end.
  -
  +      State0 = #state{realm=Realm,ets=Ets,version=Version,mw=Middleware},
  +      State = register_callback_map(?INTERNAL_RPCS, State0),
  +      {ok, State}
  +  end.
  +
  +register_callback_map(CallbackMap, State) ->
  +  %% create a session for the router itself.
  +  {ok, _SessionId} = create_session(self(),[],State),
  +  Register = fun (Url, Callback) ->
  +                {ok, RegistrationId} =
  +                    register_procedure(self(), [],
  +                                       Url, State),
  +                {RegistrationId, Callback}
  +             end,
  +  RegisteredRpcs =
  +    [ Register(Url, Callback)
  +      || {Url, Callback} <- CallbackMap
  +    ],
  +  State#state{
  +    internal_rpc_map = RegisteredRpcs
  +  }.
   
   handle_call({handle_wamp,Msg},{Pid,_Ref},State) ->
     try
  
positive.code:   {error,undefined}.
  
  
  
  
  -ifdef(TEST).
  
negative.code:   end,
    send_message_to(shutdown,Pid);
  
  handle_wamp_message({publish,RequestId,Options,Topic,Arguments,ArgumentsKw},Pid,#state{mw=MW,ets=Ets}=State) ->
    Session = disconnect_unauth(Pid, State),
    case MW:perm_publish(Session#session.id,Options,Topic,Arguments,ArgumentsKw) of
      true ->
        case ets:lookup(Ets,Topic) of
          [] ->
            %% if topic doesn't already exist create it.
            %% otherwise reflection api will not always work.
            {ok,_T} = create_topic(Topic,Options,State);
          _ ->
            pass
        end,
        {ok,_PublicationId} = send_event_to_topic(Pid,Options,Topic,Arguments,ArgumentsKw,State),
        % TODO: send a reply if asked for ...
        ok;
  