Ajey
Ajey

Reputation: 8202

Persist chat messages in node

I have built a chat app using node, express and socket io. But when I refresh the page, all the earlier chat messages are lost.

I did a little research and I read about REDIS but I am having difficulty on how to integrate redis. I searched for few node redis projects for the chat messages persistence but no luck.

Please suggest me a good approach on how to persist the chat messages and which technology is to use.

Any tutorial links are highly appreciated.

Upvotes: 1

Views: 1309

Answers (1)

Gntem
Gntem

Reputation: 7155

Although its not necessary to use Redis for this kind of task. From my point of view its a simple task, a limited size list. Having that in mind you can approach this problem from different ways

  • store in client database (browser database) the last N messages
  • store in server the list and send to every new connection

Upvotes: 1

Related Questions