Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

DeadZeta/SocketPlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SocketPlugin

Websocket server is now on pocketmine.
The websocket plugin makes it possible to communicate directly between the Poсketmine server and the Site.

Example

This example calls a handler function for each client onMessage.

<?php

namespace Lamehov\SocketPlugin;

use pocketmine\plugin\PluginBase;
use pocketmine\event\Listener;

use Lamehov\SocketPlugin\WebSocket\WSServer;

class Main extends PluginBase implements Listener {

	protected $WSServer;

	public function onEnable() {
		$this->WSServer = new WSServer;
		$this->WSServer->startSocket($this, 8000);
	}

	public function onDisable() {
		$this->WSServer->shutdownSocket($this);
	}

	public function onMessage($connection, $data) {
		WSServer::send($connection, ["Hello Client!"]);
	}
}

?>

Releases

No releases published

Packages

No packages published

Languages