1

I have to create a chat server page chat.html using node.js. I have used a a couple of modules like http://chat.nodejs.org. The problem is when I moved from chat.html page to some other page of my application like about.html and come back to chat.html I need to login again and it consider me a fresh joiner.

Is there any way/module using which I can persist the chat.

coure2011
  • 40,286
  • 83
  • 216
  • 349

2 Answers2

0

A simple approach would be to use sessions, to identify the user and load their chat history from a database.

You could also consider just storing their history into a cookie/localStorage and thus save some load on the server, unless you need to identify or store the history anyway.

Jani Hartikainen
  • 42,745
  • 10
  • 68
  • 86
0

You'll want to set up sessions in your application. Rather than describe that here, I'll link this popular answer:

Managing Sessions in Node.js?

Community
  • 1
  • 1
Alex Sexton
  • 10,401
  • 2
  • 29
  • 41