Self-cloning is functionality whitch allow Skynet to clone itself to another locations. By default this option is disabled in config - if you want to use this you must enable it in your config file.
Configuation file is placed in:
/src/SkynetUser/SkynetConfig.php
If you want to enable clone function just set to TRUE option below:
$config['core_cloner']
When @clone command is sent to clusters then every cluster will try to scan all subdirectories where cluster is placed and try to copy to them. After that (if successed) - clusters will broadcast information about new clones on the network to register new ones by other clusters.
At first, you should test this option by localhost.
Just create directory (and subdirectories in it) when cluster is placed. After that, launch your cluster with command:
@clone me;
Just type command above in webconsole and 'Send Request'.
Your cluster should be cloned into all directories in its location, and at next - a new clones should be cloned itselfs into next subdirectiories, and so one...
To remotely send @clone command to other clusters, type in webconsole:
@clone "CLUSTER_ADDRESS";
or
@clone CLUSTER_ADDRESS1, CLUSTER_ADDRESS2, CLUSTER_ADDRESS3...;
(clusters addresses without quotes)
or with argument "all" (or without any arguments) to send command to all clusters.
In Skynet every command typed without parameters is sending to all clusters by default.
Analogously, you can send command in Event Listener:
/src/SkynetUser/MyListener.php:
public function onRequest($context)
{
if($context == "beforeSend")
{
$this->request->set('@clone', 'all');
}
}
Be careful with using this option, becase if you call @clone then Skynet will replicate to ALL directories where it placed.