Pazzle
Pazzle

Reputation: 395

Understanding websockets (storage?)

I'm trying to wrap my head around websockets, I've thoroughly read through a couple of simple chat tutorials, but there's one thing that I didnt understand from the tutorials; is whenever a chat message is sent, where is the message stored? I figured the message needed to be saved to a database (sql or mongo etc), or does it just distribute the message and keep it in the servers memory or something? If thats the case, wouldnt that mean the server would get very bloated after x amount of time/slow down?

Additionally: Is it a common practice to use sockets in combination with a database at all? Or is this considered a no go?

Thanks for reading!

Upvotes: 0

Views: 409

Answers (1)

Jos
Jos

Reputation: 419

It all depends on how you deal with the message. If you want to store it, that's completely up to you.

If you do not deal with a message at all, the server won't keep things in memory. Same goes for the client.

Upvotes: 1

Related Questions