I think this would be very useful for a lot of game to have a way to configure that and easy to use api
-send message to chanel
-send message to player
-on join /on left / on new message event
You can achieve this using teams. If you think of your Channels as Teams you can use functionality that's already provided on the platform to achieve this.
So when creating a channel, you'd create a team.
To send a message to the Channel, use a SendTeamChatMessageRequest to message everyone in the team/channel.
To send a message to a player use a SparkMessage with the id of the player you wish to chat with.
If the player is a game friend you could also use a SendFriendMessageRequest to do this.
A player could then join a team/channel with a JoinTeamRequest and leave a team/channel with a LeaveTeamRequest, in the response for both of these you could use a SparkMessage to send an appropriate message to the users left in the team. You could use getMemberIds in SparkTeam in the response to get an array on members still in the team to use with the SparkMessage. If you have any further questions just let me know.
I m thinking about using gamesparks for the chat system of a game I m working on. Before I start, I d like to know, if by using this solution I will be able to request an history of the messages. More specifically, if a user is not connected to the game when a message is sent, will I be able to show it on his next start ?
If your users are in a team you can use a ListTeamChatRequest by get a list of the messages sent to the team by players using SendTeamChatMessageRequest. For all other messages you can retrieve a ListMessageRequest or a ListMessageSummaryRequest (to return a summary of the list of the current players messages/notifications. This will only return un-dismissed messages). A GetMessageRequest will return the details of a specific message if required. If the "Expire After" field is empty (set in Messages in the Portal) the message will never expire and the player will receive it next time they come online, if "Expire After" is set to 0 the message will not be queued. If you have any further questions just let me know.