Where is the better place to keep the chat records of web chat?

made a websocket chat room.

encountered a problem. Where is a better place to keep chat records?

clipboard.png

Friends list requests the server"s chat history interface (that is, to switch chat objects) when clicking Friends , but it doesn"t feel right to ask for it every time you click.

so I want to save the record.

Local Storage , Session Storage , IndexedDb ,.

I don"t know which way is better

Please state the advantages, disadvantages and implementation ideas of the ways you think are better (not limited to the above three, as long as you feel good)


closures should be appropriate. Data can be temporarily stored in memory without being released and accessed quickly.

(function(){
    var obj = {};
    function saveDate(id, data){
        //
        obj[id] = data;    
    }
    function getData(id){
        let data = obj[id] ? obj[id] : '';
        return data;
    }
    function clearData(){
        obj = null;
    }
    return {
        setData : setData,
        getData : getData,
        clearData: clearData
    }
})()
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31647-4d42c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31647-4d42c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?