{"id":18550295,"url":"https://github.com/xp-forge/websockets","last_synced_at":"2026-02-14T10:03:21.826Z","repository":{"id":57084825,"uuid":"210319208","full_name":"xp-forge/websockets","owner":"xp-forge","description":"WebSockets for the XP Framework","archived":false,"fork":false,"pushed_at":"2025-01-12T11:53:17.000Z","size":117,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-21T03:46:24.546Z","etag":null,"topics":["rfc6455","server","websockets","xp-framework"],"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/xp-forge.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","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,"zenodo":null}},"created_at":"2019-09-23T09:45:06.000Z","updated_at":"2025-01-12T11:53:12.000Z","dependencies_parsed_at":"2025-04-24T01:47:29.802Z","dependency_job_id":"d462ccea-7cda-404d-a3a2-e37c48356fa2","html_url":"https://github.com/xp-forge/websockets","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/xp-forge/websockets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fwebsockets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fwebsockets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fwebsockets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fwebsockets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xp-forge","download_url":"https://codeload.github.com/xp-forge/websockets/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fwebsockets/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29442334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T07:24:13.446Z","status":"ssl_error","status_checked_at":"2026-02-14T07:23:58.969Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["rfc6455","server","websockets","xp-framework"],"created_at":"2024-11-06T21:04:08.070Z","updated_at":"2026-02-14T10:03:21.810Z","avatar_url":"https://github.com/xp-forge.png","language":"PHP","readme":"WebSockets for the XP Framework\n========================================================================\n\n[![Build status on GitHub](https://github.com/xp-forge/websockets/workflows/Tests/badge.svg)](https://github.com/xp-forge/websockets/actions)\n[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)\n[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)\n[![Requires PHP 7.4+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_4plus.svg)](http://php.net/)\n[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)\n[![Latest Stable Version](https://poser.pugx.org/xp-forge/websockets/version.svg)](https://packagist.org/packages/xp-forge/websockets)\n\nExample\n-------\n\n```php\nuse websocket\\Listeners;\n\nclass Imitator extends Listeners {\n\n  public function serve($events) {\n    return [\n      '/echo' =\u003e function($conn, $payload) {\n        $conn-\u003esend('You said: '.$payload);\n      }\n    ];\n  }\n}\n```\n\nRun it using:\n\n```bash\n$ xp -supervise ws Imitator\n@peer.ServerSocket(Resource id #138 -\u003e tcp://0.0.0.0:8081))\nServing Imitator(dev)[] \u003e websocket.logging.ToConsole\n# ...\n```\n\nTo connect to this server, use the following:\n\n```php\nuse util\\cmd\\Console;\nuse websocket\\WebSocket;\n\n$s= new WebSocket('ws://localhost:8081/echo');\n$s-\u003econnect();\n\n$s-\u003esend('Hello');\nConsole::writeLine('\u003c\u003c\u003c ', $s-\u003ereceive());\n```\n\nOn the JavaScript side, open the connection as follows:\n\n```javascript\nvar ws = new WebSocket('ws://localhost:8081/echo');\nws.onmessage = (event) =\u003e console.log(event.data);\n\nws.send('Hello');  // Will log \"You said: Hello\" to the console\n```\n\nSee also\n--------\n\n* [WebSocket chat based on Redis queues](https://gist.github.com/thekid/7f11a62e0a57d18588694f058ebcc38a)\n* [OpenAI Realtime API](https://platform.openai.com/docs/guides/realtime)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxp-forge%2Fwebsockets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxp-forge%2Fwebsockets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxp-forge%2Fwebsockets/lists"}