{"id":19819866,"url":"https://github.com/pmmppluginsrepository/proxy-thread","last_synced_at":"2025-05-01T11:33:19.226Z","repository":{"id":125463053,"uuid":"545453700","full_name":"PMMPPluginsRepository/proxy-thread","owner":"PMMPPluginsRepository","description":"Proxy with server socket handling","archived":false,"fork":false,"pushed_at":"2022-10-05T12:59:42.000Z","size":11,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-09T23:04:15.766Z","etag":null,"topics":["php","pmmp","pmmp-virion","proxy","proxy-thread","skh6075"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PMMPPluginsRepository.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-04T11:58:53.000Z","updated_at":"2024-09-28T03:22:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3920b13-3956-428d-8cdf-5849c618867f","html_url":"https://github.com/PMMPPluginsRepository/proxy-thread","commit_stats":null,"previous_names":["pmmppluginsrepository/proxy-thread"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PMMPPluginsRepository%2Fproxy-thread","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PMMPPluginsRepository%2Fproxy-thread/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PMMPPluginsRepository%2Fproxy-thread/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PMMPPluginsRepository%2Fproxy-thread/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PMMPPluginsRepository","download_url":"https://codeload.github.com/PMMPPluginsRepository/proxy-thread/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224254194,"owners_count":17281128,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","pmmp","pmmp-virion","proxy","proxy-thread","skh6075"],"created_at":"2024-11-12T10:20:24.832Z","updated_at":"2024-11-12T10:20:25.628Z","avatar_url":"https://github.com/PMMPPluginsRepository.png","language":"PHP","readme":"# proxy-thread\nProxy with server socket handling\n\n## Usage\nConnect when the plugin that will use the proxy is activated\n\n**NOTE:** If you try to call the class without the library loaded, you will get an error. After adding `DEVirion to depend`, call the proxy class in the `onEnable` method.\n```php\nprotected function onEnable() : void{\n\t$this-\u003eproxy = libProxyThread::createMultiProxy($this, $address ?? \"127.0.0.1\");\n}\n```\n\n## Register a Proxy Server\nThis proxy library can connect multiple servers\n\n**NOTE:** `receivePort` must not be duplicated, `sendPort` is the receivePort of another proxy server.\n```php\n$this-\u003eproxy-\u003einsert(\"lobby_multi_chat\", new ProxyThread($this-\u003emultiProxy, 1000, (function(): Volatile{\n\t$volatile = new Volatile();\n\t$volatile[] = 1001; //skywars multi chat proxy port\n\treturn $volatile;\n})()));\n$this-\u003eproxy-\u003einsert(\"skywars_multi_chat\", new ProxyThread($this-\u003emultiProxy, 1001, (function(): Volatile{\n\t$volatile = new Volatile();\n\t$volatile[] = 1000; //lobby multi chat proxy port\n\treturn $volatile;\n})()));\n```\n\n## Example Proxy Handling\nWhen the chat is sent from the lobby server, it is also sent to the skywars server.\n\n**CHANNEL:** `lobby`\n```php\npublic function onPlayerChatEvent(PlayerChatEvent $event): void{\n\tif(!$event-\u003eisCancelled()){\n\t\t$this-\u003eproxy-\u003eselect(\"skywars_multi_chat\")-\u003esend([\n\t\t\tProxyThread::KEY_IDENTIFY =\u003e \"multi-chat\",\n\t\t\tProxyThread::KEY_DATA =\u003e [\"format\" =\u003e $event-\u003egetFormat()]\n\t\t]);\n\t}\n}\n```\n**CHANNEL:** `skywars`\n```php\npublic function onProxyReceiveDataEvent(ProxyReceiveDataEvent $event): void{\n\t$iterator = $event-\u003egetIterator();\n\tif($iterator-\u003eoffsetGet(ProxyThread::KEY_IDENTIFY) !== \"multi-chat\"){\n\t\treturn;\n\t}\n\t$data = $iterator-\u003eoffsetGet(ProxyThread::KEY_DATA);\n\t$this-\u003egetServer()-\u003ebroadcastMessage($data[\"format\"]);\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmmppluginsrepository%2Fproxy-thread","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmmppluginsrepository%2Fproxy-thread","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmmppluginsrepository%2Fproxy-thread/lists"}