{"id":13743737,"url":"https://github.com/GulDmitry/php-websocket-server","last_synced_at":"2025-05-09T01:31:43.380Z","repository":{"id":1574551,"uuid":"2018771","full_name":"GulDmitry/php-websocket-server","owner":"GulDmitry","description":"PHP WebSocket Server for PHP 5.3","archived":false,"fork":false,"pushed_at":"2012-07-29T16:49:48.000Z","size":1407,"stargazers_count":28,"open_issues_count":1,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-15T14:35:49.387Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"ActionScript","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/GulDmitry.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}},"created_at":"2011-07-08T16:36:48.000Z","updated_at":"2022-01-10T14:44:18.000Z","dependencies_parsed_at":"2022-08-28T11:11:52.833Z","dependency_job_id":null,"html_url":"https://github.com/GulDmitry/php-websocket-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GulDmitry%2Fphp-websocket-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GulDmitry%2Fphp-websocket-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GulDmitry%2Fphp-websocket-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GulDmitry%2Fphp-websocket-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GulDmitry","download_url":"https://codeload.github.com/GulDmitry/php-websocket-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253174353,"owners_count":21865851,"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-08-03T05:00:55.979Z","updated_at":"2025-05-09T01:31:38.368Z","avatar_url":"https://github.com/GulDmitry.png","language":"ActionScript","readme":"PHP WebSocket Server\n====================\n\nBased on [php-websocket](https://github.com/nicokaiser/php-websocket) by Nico Kaiser\n\nUsed websocket [protocol 10](http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10) or higher.\n\nIf you want more powerful server see: [Jeff Morgan websocket server](https://github.com/jam1401/PHP-Websockets-Server), also you can look in the direction of the [this](https://github.com/lemmingzshadow/php-websocket) server, especially for php client implementation. :-)\n\n##Changes\n\n### 1. Native namespaces\n\n### 2. New methods\n\n### 3. Draft-ietf-hybi-thewebsocketprotocol-10+\n\n####Connection object.\n\nSend\\broadcast to all server, application and group connections.\n\n    /**\n     * Send to current socket\n     * \n     * @param string $data \n     */\n    public function send($data)\n\n-------------------------------------------------------\n\n    /**\n     * Send to all server sockets\n     * \n     * @param string $message \n     */\n    public function sendServer($message)\n\n    /**\n     * Broadcats to all server sockets\n     * \n     * @param string $message \n     */\n    public function broadcastServer($message)\n\n-------------------------------------------------------\n    \n    /**\n     * Custom counter increment\n     * \n     * @param int $num \n     */\n    public function incrementMsgStack($num)\n\n    /**\n     * Custom counter decrement\n     * \n     * @param int $num \n     */\n    public function decrementMsgStack($num)\n\n    /**\n     * Reset counter\n     */\n    public function resetMsgStack()\n\n-------------------------------------------------------\n    \n    /**\n     * Socket standing\n     * \n     * @return bool TRUE if socket open, else FALSE\n     */\n    public function getSocketAlive()\n\n-------------------------------------------------------\n    \n    /**\n     * Send to current connection group if $key = false\n     * \n     * @param mixed $key Group identifier\n     * @param string $message \n     */\n    public function sendGroup($message, $key = false)\n\n\n    /**\n     * Broadcast to current connection group if $key = false\n     *\n     * @param mixed $key Group identifier\n     * @param string $message \n     */\n    public function broadcastGroup($message, $key = false)\n\n    /**\n     *\n     * @param mixed $key\n     * @param Connection $connection \n     */\n    public function setGroup($key)\n\n    /**\n     * @param mixed $key\n     * @return mixe Connections in group with $key, or false if group not exists\n     */\n    public function getConnectionsByGroupKey($key)\n\n    /**\n     * Get current socket group key\n     * \n     * @return mixed Group key or false\n     */\n    public function getGroup()\n\n#### Application class.\n\n    /**\n     * Send to application sockets\n     * \n     * @param string $message \n     */\n    public function sendApp($message)\n\n    /**\n     * Send to application sockets with exclude\n     *\n     * @param Connection $excludeConnection\n     * @param string $message \n     */\n    public function broadcastApp($excludeConnection, $message)\n\n## Start\n\n    1. Register application(s) (server.php)\n    \n    2. Start server: php server.php\n    Run server script as root (and port 843(!)). If you want custom user or port run other script\n    that listens on port 843 and returns a Socket Policy XML string for Flash players.\n    (See http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security_04.html for details.)\n\n    2. Connect to applicaton: run client/index.html in browser\n\n## Client\n\n    See client/index.html\n\n## Libraries used\n\n- [php-websocket](https://github.com/nicokaiser/php-websocket) by Nico Kaiser \n- [phpWebSockets](http://code.google.com/p/phpwebsockets/) by Moritz Wutz\n- Simon Samtleben \u003cweb@lemmingzshadow.net\u003e - hybi 10 encode \n- [web-socket-js](http://github.com/gimite/web-socket-js) by Hiroshi Ichikawa (example)\n- [jQuery](http://jquery.com/) (example)\n","funding_links":[],"categories":["Networking"],"sub_categories":["Sockets"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGulDmitry%2Fphp-websocket-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGulDmitry%2Fphp-websocket-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGulDmitry%2Fphp-websocket-server/lists"}