anchor.diff:  handle_rpc("register_remote_services", Args) ->
       {ok, Services} = rvi_common:get_json_element(["services"], Args),
       {ok, LocalServiceAddresses} = rvi_common:get_json_element(["local_service_addresses"], Args),
  -    manage_remote_services("services_available", LocalServiceAddresses, Services),
  -    { ok, [ { status, rvi_common:json_rpc_status(ok)} ] };
  -
  -handle_rpc("unregister_remote_services", Args) ->
  -    {ok, Services} = rvi_common:get_json_element(["services"], Args),
  -    {ok, LocalServiceAddresses} = rvi_common:get_json_element(["local_service_addresses"], Args),
  -    manage_remote_services("services_unavailable", LocalServiceAddresses, Services),
  +    announce_service_availability(services_available, LocalServiceAddresses, Services),
       { ok, [ { status, rvi_common:json_rpc_status(ok)} ] };
   
   handle_rpc("message", Args) ->
  
positive.code:     %% be either a wse websocket, or a regular HTTP JSON-RPC call
      case rvi_common:get_request_result(
  	   dispatch_to_local_service(NetworkAddress, 
  				     "message", 
  				     [ { service_name, SvcName },
  				       { parameters, Parameters }])) of
  
  
negative.code: 
      end.
  
  register_service(Service, ServiceAddress) ->
      ?debug("service_edge_rpc:register_service(): service: ~p ", [Service]),
      ?debug("service_edge_rpc:register_service(): address: ~p ", [ServiceAddress]),
  
      case 
  	%% Register the service at service discovery
  	rvi_common:send_component_request(service_discovery, register_local_service,
  					  [
  					   {service, Service}, 
  					   {network_address, ServiceAddress}
  					  ], [service]) of
  	{ ok, JSONStatus, [ FullSvcName ]} -> 
  	    
  	    %% Announce the new service to all connected nodes.
  	    rvi_common:send_component_request(data_link, announce_new_local_service,
  					      [
  					       %% Convert /some/svc to jlr.com/some/svc
  					       {service, rvi_common:local_service_to_string(Service)}
  					      ], [service]),	
  
  	    %% Retrieve addresses of all locally registered services.
  	    {ok, _JSONStatus, [ LocalAddresses ]} =
  		rvi_common:send_component_request(service_discovery, get_local_network_addresses,
  						    [], [addresses]),	
  	    %% Send out an announcement to all locally connected services, but skip
  	    %% the one that made the registration call
  	    announce_service_availability(services_available, LocalAddresses, [Service], ServiceAddress),
  
  	    %% Return ok.
  	    { ok, [ {service, FullSvcName}, 
  		    {status, rvi_common:json_rpc_status(JSONStatus)} ] };
  	
  	Err -> 
  	    ?debug("service_edge_rpc:register_service() Failed at service_discovery(): ~p", 
  		      [ Err ]),
  	    Err
      end.
  
  
  
  
  announce_service_availability(Cmd, LocalServiceAddresses, Services) ->
      announce_service_availability(Cmd, LocalServiceAddresses, Services, undefined).
  
  
  %% Announces the services listed in Services wit all 
  %% local services listed under LocalServices
  %% SkipAddress is a single address that, if found in LocalServiceAddresses,
  %% will not receive an announcement.
  %% This is to avoid that a local service registering itself will get a callback
  %% about its own availability.
  announce_service_availability(Cmd, LocalServiceAddresses, Services, SkipAddress) ->
      ?info("service_edge_rpc:announce_service_availability(~p, ~p, ~p): Called.", 
  		  [ Cmd, LocalServiceAddresses, Services ]),
      
      lists:map(fun(LocalServiceAddress) when LocalServiceAddress =:= SkipAddress ->
  		      ok;
  
  		 (LocalServiceAddress) ->
  		      dispatch_to_local_service(LocalServiceAddress, Cmd, 
  						[ { services, Services }])
  	      end, LocalServiceAddresses),
      { ok, [ { status, rvi_common:json_rpc_status(ok)} ] }.
      
  