Page 1 of 1

Permanent Messages ?

Posted: 12 Jan 2018, 05:42
by genar
Does smartfoxserver Supports some Kind of permanent Messages ?

I want the possibility for Players to Send each other Messages without the chat. Some Sort of private Letters. Those should stay in a list and shouldn't be Auto removed at some Point.

Is this possible ? Or do i need to Code that on myself ?

Re: Permanent Messages ?

Posted: 12 Jan 2018, 08:36
by Lapo
Hi,
private messages are possible, yes. About being "permanent", I don't know what you mean.
Once the message has been delivered to the target user, the client application could store it locally so that it's always available.

I am not sure if this is what you're looking for. An alternative would be to store these permanent messages into a database so that every user can read them when they need to.

Let me know

Re: Permanent Messages ?

Posted: 12 Jan 2018, 11:29
by genar
Thanks for your answer :)

Thats what i mean. But wouldnt that be a bit too much when storing them in an database ? Im using Mysql, imagine the server would create a table for each player, which stores the messages. That would be a mess. And i read somewhere that Mysql is only good to manage tables with much entrys, not many tables.

I hoped that SmartFoxServer would store Private Messages somewhere automaticly.

Re: Permanent Messages ?

Posted: 12 Jan 2018, 11:45
by Lapo
I don't see any problem with storing text messages with MySQL, there is nothing to worry about.
If storage limits is what concerns you, the problem would exist regardless of the medium you use (files, database etc.). In other words, storing every user's message can indeed take quite a lot of disk space.

The question is, do you really need to keep every single message? Maybe you could store a message history that goes back only a certain amount of time, so you can purge all the old data at some point.

Cheers

Re: Permanent Messages ?

Posted: 17 Jan 2018, 15:51
by rewb0rn
Hi genar,

I think you got a wrong idea about the tables. You don't need one table per user. You can have a single table for the messages for all users, maybe call it "messages". The table would contain several columns: id (primary key), text (the message), sender (id of the user who sent the message), receiver (id of the user who receives the message). That way you can store all messages for all users in one table.

You can create INDEXes for improving the access performance when searching for messages of a specific user, i.e. when you call "SELECT * FROM messages WHERE receiver = 12345", the INDEX will make sure that a read access with a given receiver is super fast.

I hope that helps.