{"id":21376063,"url":"https://github.com/lessmore92/swoole-websocket-client","last_synced_at":"2025-09-05T16:45:32.010Z","repository":{"id":37275138,"uuid":"505631120","full_name":"lessmore92/swoole-websocket-client","owner":"lessmore92","description":"Easy-to-use Swoole WebSocket Client","archived":false,"fork":false,"pushed_at":"2022-06-21T04:25:34.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-30T02:17:48.196Z","etag":null,"topics":["php","php-library","swoole","swoole-websocket","websocket","websocket-client"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lessmore92.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-20T23:49:11.000Z","updated_at":"2024-08-08T18:20:40.000Z","dependencies_parsed_at":"2022-08-25T12:32:05.892Z","dependency_job_id":null,"html_url":"https://github.com/lessmore92/swoole-websocket-client","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lessmore92/swoole-websocket-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessmore92%2Fswoole-websocket-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessmore92%2Fswoole-websocket-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessmore92%2Fswoole-websocket-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessmore92%2Fswoole-websocket-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lessmore92","download_url":"https://codeload.github.com/lessmore92/swoole-websocket-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessmore92%2Fswoole-websocket-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265128093,"owners_count":23715620,"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","php-library","swoole","swoole-websocket","websocket","websocket-client"],"created_at":"2024-11-22T09:13:38.179Z","updated_at":"2025-07-13T10:30:46.760Z","avatar_url":"https://github.com/lessmore92.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easy-to-use Swoole WebSocket Client\n\n## Installation\n\n```\ncomposer require lessmore92/swoole-websocket-client\n```\n\n## Requirements\n\n* PHP\u003e=7.4\n* [openswoole](https://openswoole.com/docs/get-started/installation)-4.11.1 (not tested other versions, maybe it works.)\n\n## Usage\n\nJust pass the web socket URL to `WebSocketClient`.\n\n\n### Note:\n* This library is for CLI-based scripts and does not work for web-based ones.\n* Because of web socket is async (and maybe be an always running task) it needs to be executed in the Swoole coroutine (`Co\\run`); see sample below.\n\n## Sample\n\n```\nuse Lessmore92\\Swoole\\WebSocketClient;\nuse function Co\\run;\n\nrequire_once \"vendor/autoload.php\";\n\nrun(function () {\n    $webSocketClient = new WebSocketClient('wss://socket.MyFancyApp.io:2053/app/app-key?protocol=7\u0026client=js\u0026version=7.0.6\u0026flash=false');\n    $webSocketClient-\u003epush('{\"event\":\"pusher:subscribe\",\"data\":{\"auth\":\"\",\"channel\":\"msgs\"}}');\n    $webSocketClient-\u003erecv();\n\n    while ($webSocketClient-\u003eclient-\u003econnected)\n    {\n        $data = $webSocketClient-\u003erecv();\n        var_dump($data);\n    }\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flessmore92%2Fswoole-websocket-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flessmore92%2Fswoole-websocket-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flessmore92%2Fswoole-websocket-client/lists"}