Sign In Register

How can we help you today?

Start a new topic

Messages backlog

The fact that messages addressed to a player are always delivered eventually, when he'll eventually log back in, is a great feature. But Its not always appropriate. I'm sending to users minor game update with certain messages that I will not want delivered on authentication, as the player will already receive a comprehensive (and more up to date) update at that time.


Is there a way to turn off the backlogging feature for certain message type? 

Alternatively I think I could use a less elegant solution involving the function Spark.dismissMessage(messageId). But I can't seem to figure out a way to get the messageId.

I tried adding code in the "ScriptMessage" script but even there Spark.getData() does not include a messageId yet.


Any help would be welcomed.


Gabriel


Hi Gabriel


Could you describe your scenario a little more. Who should get the message and who shouldn't ?


Is this linked to only sending to players if they are online ?


Players will only be sent the message if they have not already received it.


Gabriel

Yes it is somewhat related to checking if the players are online. In the event a player lose connection, he'll still be sent update messages until he is known to be offline. Those messages will be kept and sent to him when he'll be back. This does not make sense as the game will have evolve and those message will be referring to an obsolete game state. A complete update will be in order. 

I can always use a timestamp to ignore old messages when received by the client, but it feel like there is lost resources. The bunch of message could have been cancelled at the very moment the player is known to be offline and thus save memory and disk space, or at least cancelled just before being sent when they are known to be too old to send and thus save some bandwidth.


To summarize: I send a message to a player, but I would prefer him to never receive it if he haven't received it in the following 5-10 minutes.


Gabriel

Why not set eh message expiration time to 0? That's what I do. They will only get the message if they are online right when it is sent.

Yeah didnt know that works :)

Any solution here?

The best I was eventually able to do was setting a custom default message with 1 hour expiration (in Configurator->Messages->ScriptMessage Extensions). 


Then in cloud code use:  

Spark.message("myCustomMessage").setMessageData({
	"data": "a string"
}).setPlayerIds(destinationPlayerIds).send();


This is still not perfect as one hour is still enough to have you configure your client code to discard old messages (I use a custom version id in my messages).


Hope this help. Let me know if you find a better solution!


Gabriel

Hi thank you,


Well yeah it sounds the only solution so far :)

Login to post a comment