{"id":19020182,"url":"https://github.com/kanata-php/conveyor-server-client","last_synced_at":"2025-07-13T01:33:25.280Z","repository":{"id":60146815,"uuid":"541054509","full_name":"kanata-php/conveyor-server-client","owner":"kanata-php","description":"Server-Side WebSocket Client ready for Socket Conveyor","archived":false,"fork":false,"pushed_at":"2024-09-30T03:50:16.000Z","size":125,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T07:51:51.002Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/kanata-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["kanata-php"]}},"created_at":"2022-09-25T04:51:31.000Z","updated_at":"2024-09-30T03:49:57.000Z","dependencies_parsed_at":"2024-08-05T19:24:54.563Z","dependency_job_id":null,"html_url":"https://github.com/kanata-php/conveyor-server-client","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"757616eda97897b1f2713e86d09fe188ea2850e4"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/kanata-php/conveyor-server-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanata-php%2Fconveyor-server-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanata-php%2Fconveyor-server-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanata-php%2Fconveyor-server-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanata-php%2Fconveyor-server-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kanata-php","download_url":"https://codeload.github.com/kanata-php/conveyor-server-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kanata-php%2Fconveyor-server-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265080006,"owners_count":23708098,"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":[],"created_at":"2024-11-08T20:16:01.595Z","updated_at":"2025-07-13T01:33:25.262Z","avatar_url":"https://github.com/kanata-php.png","language":"PHP","funding_links":["https://github.com/sponsors/kanata-php"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg height=\"250\" src=\"./imgs/logo.svg\"/\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\n  \u003c!-- badges --\u003e\n    \u003ca href=\"https://github.com/kanata-php/conveyor-server-client/actions/workflows/php.yml\"\u003e\u003cimg src=\"https://github.com/kanata-php/conveyor-server-client/actions/workflows/php.yml/badge.svg\" alt=\"Tests\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n\u003e A server-side client for the php package [kanata-php/socket-conveyor](https://socketconveyor.com)\n\n## Prerequisites\n\n- PHP \u003e= 8.0\n- [PHP OpenSwoole Extension](https://openswoole.com/)\n\n## Install\n\n```sh\ncomposer require kanata-php/conveyor-server-client\n```\n\n## Description\n\nThis is a server-side client for the [Socket Conveyor](https://socketconveyor.com) PHP package.\n\n## Usage\n\nOnce installed, the following example shows how it works to use this package.\n\n```php\nuse Kanata\\ConveyorServerClient\\Client;\n\n$options = [\n    'onMessageCallback' =\u003e function(Client $currentClient, string $message) {\n        echo 'Message received: ' . $message . PHP_EOL;\n    },\n];\n\n$client = new Client($options);\n$client-\u003econnect();\n```\n\nWith the previous example you'll have a PHP script connected and waiting for messages to come. For each message received there will be a printed message in the terminal executing this script. This client will try to connect to `ws://127.0.0.1:8000`. To understand more Socket Conveyor channel and listeners you can head to its [documentation](https://socketconveyor.com).\n\n\u003e **Important:** this example doesn't have **timeout**. This means it will be running until its process gets killed. If you just need to listen for a limited time, or need a timeout for any other reason, use the `timeout` option.\n\nThis package has the following options (showing its respective defaults):\n\n```php\n[\n    /**\n     * @var string\n     */\n    'protocol' =\u003e 'ws',\n    \n    /**\n     * @var string\n     */\n    'uri' =\u003e '127.0.0.1',\n    \n    /**\n     * @var int\n     */\n    'port' =\u003e 8000,\n    \n    /**\n     * @var string\n     */\n    'query' =\u003e '',\n    \n    /**\n     * @var ?string\n     */\n    'channel' =\u003e  null,\n    \n    /**\n     * @var ?string\n     */\n    'listen' =\u003e null,\n    \n    /**\n     * @var ?callable\n     */\n    'onOpenCallback' =\u003e null,\n    \n    /**\n     * @var ?callable\n     */\n    'onReadyCallback' =\u003e null,\n    \n    /**\n     * Callback for incoming messages.\n     * Passed parameters:\n     *   - \\WebSocket\\Client $client\n     *   - string $message\n     *\n     * @var ?callable\n     */\n    'onMessageCallback' =\u003e null,\n    \n    /**\n     * Callback for disconnection.\n     * Passed parameters:\n     *   - \\WebSocket\\Client $client\n     *   - int $reconnectionAttemptsCount\n     *\n     * @var ?callable\n     */\n    'onDisconnectCallback' =\u003e null,\n    \n    /**\n     * Callback for Reconnection moment.\n     * Passed parameters:\n     *   - \\WebSocket\\Client $client\n     *   - int \\Throwable $e\n     *\n     * @var ?callable\n     */\n    'onReconnectionCallback' =\u003e null,\n    \n    /**\n     * When positive, considered in seconds\n     *\n     * @var int\n     */\n    'timeout' =\u003e -1,\n    \n    /**\n     * @var bool\n     */\n    'reconnect' =\u003e false;\n    \n    /**\n     * Number of attempts if disconnects\n     * For this to keeps trying forever, set it to -1. \n     *\n     * @var int\n     */\n    'reconnectionAttempts' =\u003e = 0;\n    \n    /**\n     * Interval to reconnect in seconds \n     * \n     * @var int \n     */\n    'reconnectionInterval' =\u003e = 2;\n]\n```\n\nThis is this package's Conveyor Client interface:\n\n```php\nnamespace Kanata\\ConveyorServerClient;\n\nuse WebSocket\\Client;\n\ninterface ClientInterface\n{\n    public function connect(): void;\n    public function getClient(): ?Client;\n    public function close(): void;\n    public function send(string $message): void;\n    public function sendRaw(string $message): void;\n}\n```\n\n## Author\n\n👤 **Savio Resende**\n\n* Website: https://savioresende.com.br\n* GitHub: [@lotharthesavior](https://github.com/lotharthesavior)\n\n## 📝 License\n\nCopyright © 2022 [Savio Resende](https://github.com/lotharthesavior).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanata-php%2Fconveyor-server-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkanata-php%2Fconveyor-server-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkanata-php%2Fconveyor-server-client/lists"}