Permanent Messages ?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

genar
Posts: 137
Joined: 13 Jul 2017, 11:49

Permanent Messages ?

Postby genar » 12 Jan 2018, 05:42

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 ?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Permanent Messages ?

Postby Lapo » 12 Jan 2018, 08:36

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
Lapo
--
gotoAndPlay()
...addicted to flash games
genar
Posts: 137
Joined: 13 Jul 2017, 11:49

Re: Permanent Messages ?

Postby genar » 12 Jan 2018, 11:29

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.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Permanent Messages ?

Postby Lapo » 12 Jan 2018, 11:45

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
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
rewb0rn
Posts: 177
Joined: 26 Jan 2009, 12:54
Location: Berlin, Germany

Re: Permanent Messages ?

Postby rewb0rn » 17 Jan 2018, 15:51

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.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 55 guests