How to Efficiently Send updates in a Chat App with Node.js, Socket.io?

I’m developing a chat application with Node.js and Socket.io for the backend. The frontend is built with React.js for the web and Flutter for mobile platforms.

In many implementations I’ve seen, the entire chat history is sent every time a user opens a specific chat, which seems inefficient. I want to optimize this by sending only the new messages or updates that have occurred since the user last accessed the chat.

Key Updates to Handle:

New messages that have been sent.
Actions such as message deletion, changes to group images, and other metadata updates.

I’m looking for advice on how to structure this to achieve efficient and real-time updates with minimal data overhead.