javascript - Best Caching for a Chatting System

one text

I created a chatting website that gives real time chat like messenger. I do this by using setinterval to spit out latest messages and notifs from my other php files.

messageRefresh = setInterval(() => {
            $.post('includes/ajax-func/getchat-afunc.php', {
                         outgoingUsersId : sender,
                         incomingUsersId : receiver,
                         newMsgCount : msgCount
                      }, function (response) {
                          $(messageSection).html(response);
                 });
          }, 500
  );

But there is a warning in DOM saying these errors:

1st 2nd 3rd

How to eradicate this errors and what cache format (eg. max-age, no-cache, etc.) should I use?

Source