How can i send message broadcast to all network that i have? Like i want to do /say and get all my registered servers to make a signal and send the message for all the players on the network? (Please don't say me to use Hormones, because has too many bugs and too many things, and i just want to broadcast..)
I'd rather you use a database so you get how it all works. You can proceed to sockets then if you think there's a significant delay in messages. But then again, hormones already does that. What kind of database do you use the most?
I use mysqli database, but can you tell me how to connect the servers and send a message to a player in $player->sendMessage but on sockets? and witch is faster to do, database or sockets? I think sockets is more easier to do then database
Sockets isn't easy and databases make use of sockets. It will be faster with sockets, no doubt. You'll need to learn about Threads and Workers before proceeding. You have to dedicate a Worker thread on server startup that will check for incoming messages the whole time the server is running -- this is the only hard part. Another way would be creating custom packets and handling the packet on both servers. That way you are making use of an already open socket and won't need to worry about threading, opening sockets, closing sockets etc (I doubt whether this one is possible).
Omg, that's so crazy it's too much complex for me, someone should create something like Bukkit that connects all servers easier and run all functions of the software like send message and etc.. Anywars, but what about that code, what they do? This connect each server together PHP: if(!($sock = socket_create(AF_INET, SOCK_STREAM, 0))){ $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); die("Couldn't create socket: [$errorcode] $errormsg \n");} echo "Socket created \n"; if(!socket_connect($sock , '0.0.0.0' , 19132)){ $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); die("Could not connect: [$errorcode] $errormsg \n");} echo "Connection established \n"; but what about that? PHP: $message = "YourMessage";//Send the message to the serverif( ! socket_send ( $sock , $message , strlen($message) , 0)){ $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); die("Could not send data: [$errorcode] $errormsg" . PHP_EOL);}echo "Message send successfully" . PHP_EOL; Is not there an easier way of all that? ;-; I just want to send a message broadcast for all players in all the network, whitout too much like Hormones..
Hormones is an abuse. You shouldn't be using databases for message queues/buffers. I initially made it as a proof of concept, but it ended up getting too popular because of how easy it is to install (MySQL setup is trivial; a custom central gateway isn't).
Yeah i have thinking to do that all the time, but how did you say "THIS IS HIGHLY UN-RECOMMENDED!!! PLEASE TAKE THIS WARNING AND DON'T DO THIS. MAY CAUSE EXTREME PERFORMANCE ISSUES, AND I'M NOT TO BE HELD RELIABLE.".
What about that? https://www.spigotmc.org/threads/tutorial-handling-data-through-multiple-servers.959/ Can i do on pocketmine?
Which method are you referring to? We will most likely never officially add this to PocketMine. First of all, we don't have an official bungee cord service. Second, how bungee cord works is quite incompatible with how our API is heading towards (where everything is very synchronous, including plugin data). This will however be inefficient if you have an enormous network, e.g. one with 100 servers. I personally find it better to have a middleman server instead of directly connecting different servers, because then you only need to set one address in the config of each server. As I said, if you have 100 servers, every time you change a certain server's IP or port, you need to edit your config 100 times. If you use a middleman (kind of like the MySQL in Hormones), you just need to update it once, and it can be done automatically. You can also setup more specific synchronization behaviour instead of just randomly passing messages at an inconsistent pace. (This is something Hormones cannot do either)