Persisting message in chat room

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

Moderators: Lapo, Bax

Skills07
Posts: 103
Joined: 07 Nov 2016, 14:54
Location: Italy

Persisting message in chat room

Postby Skills07 » 13 Apr 2017, 07:50

Hello Lapo and Friends

I need to say something about chat rooms.
Yesterday we have implemented a clan chat room and all works properly.
We can chat without any problem.
We have decided to create a chat room when a clan is created, if all users leave the game, the room is destroyed.
At the login of a member we saw if the clan_room is existing and move the user in that room, or if is not existing recreate the room.

Now i want to know how to save the message of the chat, and reload it when we restart play the game.
How can i do this?
There is something to do client-side or server-side?
Or there is a setting on smartfox server? Or i need to save my message on a table in the db??

Thanks to all for the help
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Persisting message in chat room

Postby Lapo » 13 Apr 2017, 07:56

We don't provide tools for managing the chat history so you can choose whatever way you prefer for your application.
If you plan to store the messages from server side in a database you can use the SFSEvent.PUBLIC_MESSAGE to catch all chat messages that are sent and received.

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Skills07
Posts: 103
Joined: 07 Nov 2016, 14:54
Location: Italy

Re: Persisting message in chat room

Postby Skills07 » 14 Apr 2017, 09:40

Ok lapo thanks

yesterday i have implemented the chat_table.
On clan registration i create a table named clan_chat_table

on chatting with the members ,all members send with an handler a message and i register this on the table.

On login when i recreate the room, i read this table, and then return the first 100 message written in the table.

We have decided at the finish of the app, that one day at week we can do manutention of the database :)

Thanks for your help

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 91 guests