anchor.diff:      ok = delete_useless_token(State#state.device_list),
       NewPid ! {msg_cache, State#state.msg_cache},
       {stop, {replaced_by, NewPid}, State};
  -handle_info({msg_cache, OriginalMsgCache},
  -            #state{msg_cache = MsgCache} = State) ->
  -    NewState = case OriginalMsgCache of
  +handle_info({msg_cache, OriginalMsgCache}, State) ->
  +    case OriginalMsgCache of
           [] ->
  -            State;
  +            NewState = State;
           _ ->
  -            ok = send_msg_2_multiple1_device(State#state.device_list,
  -                                            OriginalMsgCache),
  -            State#state{msg_cache = MsgCache ++ OriginalMsgCache}
  +
  +            {ok, NewState} = merge_msg_cache(State, OriginalMsgCache)
       end,
       {noreply, NewState, NewState#state.heartbeat_timeout};
   handle_info(timeout, State) ->
  
positive.code: 
  handle_info({replace_socket, Message, #device{socket = Socket} = Device},
              #state{device_list = DeviceList} = State) ->
      NewState = case lists:keytake(Device#device.name,
                                    #device.name, DeviceList) of
          {value, #device{socket = OldSocket} = OldDevice, OtherDeivces} ->
  
negative.code: 
  
  process_message(Socket, State, {Type, Attrs}) ->
      {value, Device, OtherDeivces} = lists:keytake(Socket,
                                                    #device.socket,
                                                    State#state.device_list),
  
      {<<"id">>, MsgId} = lists:keyfind(<<"id">>, 1, Attrs),
      log:i("Got msg id=~p~n", [MsgId]),
  