How to create a cross-server invite without hitting the MessagingService limit

I am trying to create a reliable cross-server invite, but looking at the limits, I’m having a hard time figuring out a way to do this without the server screaming “LIMIT REACHED” at me.
So here are the limits:
image

So the first thing we have to take into consideration is that I want the players to be able to see which one of their friends are offline, online or in-game. To do this, a good approach could be to make a server list which updates every X seconds so that I have all the data necessary and I can just use the JobID of a server, sending the username to invite, and use TeleportService to manage everything else.
Great! But now the limits come in.

In order to keep the server list updated, I need the servers to constantly send their data to all other servers. Now, as you can see above, the whole game can receive ServerCount * 50 messages per minute. This means that if every server were to send his own data to all other servers every minute, the messages received would be ServerCount * ServerCount, you can see how this would reach the limit at 51 servers open.

So the next approach would need to be something more “centralized”, where a single server manages the whole list and works as the pivot of all data. Basically, all servers would refer to this Main Server and send their data to it, from there, the MainServer would send data to every other server. This solves the messages received problem since the cost of update now would be ServerCount * 2, but the problem with this approach is deciding which server has to be the top one. Also, the top server can send limited messaged, meaning in the worst-case scenario, it could only maintain 150 + 60 servers, depending on the player count in the server. This is very bad since now an uncorrelated factor has control over how many servers my system can maintain.

The final approach I have in mind is the “snake biting his tail” approach. Basically, I would have a system where every server notifies the next in line and slowly builds up data until it reaches the end of the line, at which point the list would loop, starting again from Server1. This is what it would look like:
Server1 -> Server2 -> Server3 -> Server4 -> Server5 -> Server1...
Sending their players list and previous data every time. This approach has a cost of ServerCount * 1 and does not suffer from data sent limitations, the full list of servers and players would reach every server only at the second loop and I would have to fit all of the data in 1 Kb, but I could increase the cost to ServerCount * 2 to send a second KB. In this approach, it’s important to keep in mind that every new server added to the list will send an occasional ServerCount * 1 messages, which is fine, since the limit per minute increased by the same amount as the server was added. In terms of cost, this system is great, but the problem is that a chain is only as strong as its weakest link, meaning that if a server crashes without notifying the chain to fix itself, the whole system breaks, and I don’t know how to prevent this.

I really need some help on this, I’m out of ideas, how do people even do this stuff??

1 Like

Actually, nevermind everything I said, I’m a dum dum
GetFriendsAsync, GetFriendsOnline and GetPlayerPlaceInstanceAsync are a thing, and you can use these alongside MessagingService to make what i’m trying to do.

I should really learn to stop overthinking stuff, this is my first post on the DevForum and I already messed up >->

1 Like