Sobana

A non-blocking TCP networking library for PocketMine-MP

Stars
3
Committers
1

Sobana

A non-blocking TCP networking library for PocketMine-MP

Example

  • SobanaHttp - Example Sobana HTTP server

Creating TCP Server

  • Creating Server
$server = Sobana::createServer("0.0.0.0", 8080, MySession::class);
$server->start();
  • Creating Session
class MySession extends ServerSession{

    public function handlePacket(string $packet): void{
        $this->write("HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\nHello World");
        $this->close();
    }
}
  • Creating Encoder/Decoder
    See example plugin