I've a database with schema named Message where it contains alot of post.
How can i list all those post whenever i loggedin into my account. I've put on socket connection as
io.on('connection', async (socket) => {
Message.find({}, (err, docs) => {
socket.emit("list message", docs) //emit list message on connection
})})
and on client (react) as
if(socket) //if socket is not null
socket.on('list message', (data) ={// do things with data})
But i cant get any day on login or even when refereshing. where can be problem? Thank you for your help