anchor.diff:             [{<<"id">>, MsgId}]},
       {ok, AckBin} = toml:term_2_binary(Ack),
       AckMessage = #message{id = MsgId, bin = AckBin},
  -    ok = gen_tcp:send(Device#device.socket, AckBin),
  -    NewMsgCache = [AckMessage|State#state.msg_cache],
  +    ok = gen_tcp:send(Socket, AckBin),
  +    NewDeviceMsgCache = [AckMessage|Device#device.msg_cache],
  +    NewDevice = Device#device{msg_cache = NewDeviceMsgCache},
  +    NewDeviceList = lists:keystore(Socket,
  +                                   #device.socket,
  +                                   State#state.device_list,
  +                                   NewDevice),
  +    NewStateTemp = State#state{device_list = NewDeviceList},
   
       NewAttrs = add_ts_from(Attrs, State#state.user_id),
       NewToml = {Type, NewAttrs},
       {ok, NewTomlBin} = toml:term_2_binary(NewToml),
       Message = #message{id = MsgId, bin = NewTomlBin},
  -    ok = send_msg_2_multiple_device(OtherDeivces, Message),
  -    {ok, Message, State#state{msg_cache = NewMsgCache}}.
  +    {ok, NewState} = send_msg_2_multiple_device(OtherDeivces,
  +                                                Message,
  +                                                NewStateTemp,
  +                                                ignore),
  +    {ok, Message, NewState}.
   
   
   add_ts_from(Attrs, UserId) ->
  
positive.code:             ok = delete_useless_token([OldDevice]),
  
              OldDeviceMsgCache = OldDevice#device.msg_cache,
              ok = send_msg_cache(Socket, [Message|OldDeviceMsgCache]),
  
              NewDevice = Device#device{msg_cache = OldDeviceMsgCache},
              State#state{device_list = [NewDevice|OtherDeivces]};
          false ->
              ok = gen_tcp:send(Socket, Message#message.bin),
              State#state{device_list = [Device|DeviceList]}
      end,
      setopts(Socket),
  
negative.code: 
  handle_info({replace_socket, Message, #device{socket = Socket} = Device},
              #state{device_list = DeviceList} = State) ->
      ok = gen_tcp:send(Socket, Message#message.bin),
  
      NewState = case lists:keytake(Device#device.name,
                                    #device.name, DeviceList) of
          {value, #device{socket = OldSocket} = OldDevice, OtherDeivces} ->
  