Now, I'm developing a web service to synchronize chats with the web and PocketMine-MP. The web server uses Node.js. And using Socket.IO for chat synchronization. I found this library when I was looking for a library that can use Socket.IO in PHP. So I used the composer to install the library. In order to load the library from the PocketMine-MP plugin after installing the library, I wrote the following code. PHP: <?phpnamespace EasyCHAT;require_once __DIR__ . '/vendor/autoload.php';use PHPSocketIO\SocketIO;use Workerman\Worker;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\Server;use pocketmine\event\Listener;use pocketmine\event\player\PlayerChatEvent;use pocketmine\utils\Config;class EasyCHAT extends PluginBase implements Listener{public $client;public function onEnable(){global $client; require_once __DIR__ . '/vendor/autoload.php'; if(!file_exists($this->getDataFolder())){ mkdir($this->getDataFolder(), 0744, true); $this->config = new Config($this->getDataFolder()."Data.json", Config::JSON); $this->config->set("ID", ""); $this->config->save(); } $this->config = new Config($this->getDataFolder()."Data.json", Config::JSON); $this->getServer()->getPluginManager()->registerEvents($this, $this); $io = new SocketIO('http://192.168.1.10:3000'); $io->emit('roomin', '123456');}public function onChat(PlayerChatEvent $event){ global $io; $Message = $event->getMessage(); $PlayerName = $event->getPlayer()->getName(); $array['id'] = $this->config->get('ID'); $array['message'] = 'TESTMESSAGE'; $io->emit('send', json_encode($array)); Worker::runAll();}} I tried starting up the server. But, This error was output to the console. The location of files is as follows. Easy-CHAT.php src| -These files vendor| Files placed by composer How to disappear errors and WebSocket communication will be possible? Give me advices.
I doubt the autoloader is even working or composer even works with PMMP based plugin I havent bothered to read the code of the libary but i am doubting it would work nicely with PMMP you may need to tweak it a bit it kinda uses a "react" style or whatever it's called which i suspect blocks the main thread but you should take my word as a grain of salt
i honesty dont know when i need a library i just forcefully hack it inside manually installing it so maybe that can be your last resort as miner is quite outdated if my guess is right
i bet someone will have a better idea then me, but my first attempt would be try to squish them into your source folder and see if it works
Are there other Socket.IO libraries that can be used with PMMP? However, there are cases where Node.js sends messages to PMMP.
What file namespace? I found such a sentence in Miner's thread. Could you tell me how to register with PocketMine's Autoloader? Sorry to bother you again...
What have you tried? You just need to register a custom PSR-4 autoloader... PHP spl_autoload_register never required that there must only be one autoloader.
I examined it, but I could not understand it with my knowledge. The sites I watched http://qiita.com/inouet/items/0208237629496070bbd4 http://qiita.com/misogi@github/items/8d02f2eac9a91b4e6215 http://php-archive.net/php/class-autoload/ Would you please tell me where and how to change