2015-06-22 22:52:26 +02:00
|
|
|
The CommuncationListening of the Communcation Manager can be enabled in the ingame Settings.
|
2015-06-21 21:45:52 +02:00
|
|
|
|
2015-06-22 22:52:26 +02:00
|
|
|
There the following settings are existing:
|
|
|
|
-- Enable Socket Listening (Let the CommunicationManager listen for incoming calls)
|
|
|
|
-- Passsword (Password which get used to encrypt and decrypt the messages for the openssl connection)
|
|
|
|
-- Listening port for every server (this is the port the CommunicationManager listens at)
|
|
|
|
|
2015-06-23 16:57:11 +02:00
|
|
|
|
|
|
|
For the description of the available implemented communcation Methods check the CommunicationMethods interface.
|
|
|
|
|
|
|
|
|
2015-06-22 22:52:26 +02:00
|
|
|
Sample ManiaControl Implementation (for ManiaControl to ManiaControl connections)
|
|
|
|
|
|
|
|
##php code begin
|
|
|
|
$communication = $this->maniaControl->getCommunicationManager()->createCommunication(IP/Domain, PORT, 'YOUR_PASSWORD');
|
2015-06-23 16:57:11 +02:00
|
|
|
$communication->call(function($data){
|
2015-06-22 22:52:26 +02:00
|
|
|
var_dump($data);
|
|
|
|
}, CommunicationMethods::GET_SERVER_CHAT);
|
|
|
|
##php code end
|
|
|
|
|
|
|
|
Sample Web Implementation (to call ManiaControl from a website)
|
|
|
|
##php code begin
|
2015-06-21 21:45:52 +02:00
|
|
|
$errno = null;
|
|
|
|
$errstr = null;
|
|
|
|
$socket = fsockopen("xx.xxx.xx.xx", xxxxx, $errno, $errstr, 2);
|
|
|
|
echo "ok?" . $errno . " - " . $errstr . "\n";
|
|
|
|
|
|
|
|
$data = array("method" => "getServerChat", "data" => "");
|
|
|
|
|
|
|
|
// Encode and Encrypt the Data
|
|
|
|
$data = json_encode(array("method" => "getServerChat", "data" => ""));
|
|
|
|
$data = openssl_encrypt($data, 'aes-192-cbc', 'YOUR_PASSWORD', OPENSSL_RAW_DATA, 'kZ2Kt0CzKUjN2MJX');
|
|
|
|
|
|
|
|
// Write the Data on the Socket
|
|
|
|
fwrite($socket, strlen($data) . "\n" . $data);
|
|
|
|
|
|
|
|
|
|
|
|
// Read Answer Data
|
|
|
|
$len = (int)fgets($socket);
|
|
|
|
echo $len;
|
2015-06-21 22:24:10 +02:00
|
|
|
$buff = '';
|
2015-06-21 21:45:52 +02:00
|
|
|
while (!feof($socket) && strlen($buff) < $len) {
|
|
|
|
$buff .= fgets($socket, $len - strlen($buff) + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Decrypt and Decode the Response Data
|
|
|
|
$data = openssl_decrypt($buff, 'aes-192-cbc', 'YOUR_PASSWORD', OPENSSL_RAW_DATA, 'kZ2Kt0CzKUjN2MJX');
|
|
|
|
echo json_decode($data);
|
|
|
|
|
|
|
|
//Close the Socket
|
|
|
|
fclose($socket);
|
2015-06-22 22:52:26 +02:00
|
|
|
##php code end
|