Hi, I'm trying to establish a connexion between a HTML5 client and Pocketmine. To do that i've imaginated that the best way to do it is to code a new plugin inspired from BigBrother. HTML 5 <------ WebSockets -----> Plugin <---------> Pocketmine *The HTML5 client is setup. *The plugin is setup * I've successfully established a websocket connexion between my html5 client and my plugin Connect ---------> plugin Connected <------- plugin OpenSession ------> plugin --------> xxx PocketMine Core I'm stuck here : I lost the trace here in my plugin (this part is the same as Bigbrother) ProtocolInterface.php Code: }elseif($pid === ServerManager::PACKET_OPEN_SESSION){ $id = Binary::readInt(substr($buffer, $offset, 4)); $offset += 4; if(isset($this->sessionsPlayers[$id])){ continue; } $len = ord($buffer{$offset++}); $address = substr($buffer, $offset, $len); $offset += $len; $port = Binary::readShort(substr($buffer, $offset, 2), false); $identifier = "$id:$address:$port"; $player = new DesktopPlayer($this, $identifier, $address, $port); $this->sessions->attach($player, $id); $this->sessionsPlayers[$id] = $player; $this->plugin->getServer()->addPlayer($identifier, $player); $identifier contains "id:<ipofmyclientwebsocket>:<portofmyclientwebsocket>" all is ok. But, nothing happens after addPlayer. The server doesn't seem to send any packet to the client or to trigger any event. Is the client is supposed to do anything ? What should the server do ? Thx in advance,
at least i succeded to establish the connexion and send a packet to the html5 client... https://twitter.com/BlocksAndGold/status/518772926422986753 Next step, - Spawn the player to a flat world, exchange positions and move around. - After that i'll try to load a chuck, but i'm not sure if it's really what I want. I don't know if my little html5 application will be able to render thousands of cubes...
WebSockets. Browser only allow this type of sockets. It's a layer over TCP. At the PocketMine side, I use a small lib to frame and deframe the TCP packets : TCP => Websockets
Chat is working It was harder than i though ;-) I've lost a lot of time because i haven't got any response to my chat packets because my player was dead at server side oO So i added a repawn packet and all has began to work https://twitter.com/BlocksAndGold/status/520611834895036417 Tomorrow (or before the end of the week, I'll add moving. (On a fake flat 16x16 world)
Spawn, positions, and directions are ok. I can talk and walk around. I have to add interpolation between positions update to have smooth move. @shoghicp I don't find JS code to convert minecraft color tag to HTML tags ? https://twitter.com/BlocksAndGold/status/522806735007137792
http://minecraft.gamepedia.com/Formatting_codes If you look at the table here, in the hex section is the HTML color code without the hash.