In ManiaLive 2.4, we introduced a first draft of a communication protocol between any system which is listening to dedicated callbacks. At the moment, we're using it only between the Dedicated Manager and ManiaLive for a simple purpose (checking if ManiaLive is running and stopping it) but we hope it will be extended in the future.
As it is a draft and it is not already widely used, the discussion about messages format is totally open. Anyone who wants to contribute is welcome, as long as there is a standard to keep compatibility between systems implementing it. The fact it is a draft also means it can be replaced by anything else for any reason.
First, we're using the Echo method so here are a few things to know before starting:
- Messages are sent by calling Echo method on the dedicated
- Message are received by the callback ManiaPlanet.Echo
- Echo callback is always sent to everyone
- Echo method and ManiaPlanet.Echo callback have 2 arguments but there are not in the same order (which most probably won't be fixed)
So now, here is how it works at the moment...
Format
Code: Select all
Echo(sender, message) to send a message
ManiaPlanet.Echo(message, sender) when receiving a message
Code: Select all
Message:
(?|!)method[:recipient]
method is a single word
:recipient is optional but used when you want a single system to take care of the message (meaning other systems must ignore it)
Identifiers
Senders and recipients have to be a string, preferably unique. As an example, we have at the moment "ManiaLive 2.4" and "DedicatedManager 1.5". It's not perfect as it doesn't ensure unicity (eg. if you have 2 instances of ManiaLive 2.4) but that's why it's only a draft.
Methods
census: ask systems to identify themselves.
Code: Select all
Sent request:
Echo( DedicatedManager 1.5 , ?census )
Received answer:
ManiaPlanet.Echo( !census:DedicatedManager 1.5 , ManiaLive 2.4 )
Code: Select all
Sent request:
Echo( DedicatedManager 1.5 , ?stop:ManiaLive 2.4 )
And that's all to know (I think). Feel free to comment, contribute or implement it in your controllers!
