Two way communication with messaging service

The reason I need this is because i’m making a global chat system and if messages are posted before the server starts, then I need to retrive those, one way I was thinking was the server requesting the messages from an other server, and the other server returns the messages. However I do realise this can be done with datastores by saving the message after it has posted in the datastore, however this will probably make me hit the rate limit. I mean if theres an other way to do this with datastores im all in for it

Cache the messages on the oldest server and send them to the rest of the servers

Honestly, I don’t know how to get the oldest server, how would that even be possible? Currently I did figure out a solution using datastores, but it’s not the best. Is there an API or something to get the oldest server?

There is no API for this AFAIK. When a server is created, assign it a value with os.time(). When you send data using messagingservice, include the os.time() value inside of it. The message with the lowest server age in terms of the time that it was created is therefore the oldest server.

So basically when a server requests messages, fire an other messaging server event, and when its connected to it, check if this server was just started. Then store all the dates as an index with the post values as the value. Then iterate through that and see which one is the lowest, and the one with the index with the lowest time is the server you get results from.

I think this is to expensive since it could iterate over 800 servers for a big game

Yes it is too expensive and is also why larger-scale games do not use MessagingService to the best of my knowledge.

Best we can do is hope that roblox pushes through with their universal scripts.

Wait a minute what’s universal scripts? Is it like a server for all the servers, a main server with a bunch of servers that would be VERY useful for my game. Actually lets talk about this in DM’s cause my post might get flagged.