{"id":24064447,"url":"https://github.com/linzap/longpolling_room","last_synced_at":"2025-07-22T18:33:50.615Z","repository":{"id":16571019,"uuid":"19324969","full_name":"LinZap/longpolling_room","owner":"LinZap","description":"long polling chatroom sample","archived":false,"fork":false,"pushed_at":"2014-11-15T08:59:38.000Z","size":219,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-23T18:53:31.660Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://zap.comze.com/longpolling_room/","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/LinZap.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":"2014-04-30T19:34:16.000Z","updated_at":"2019-06-17T01:37:33.000Z","dependencies_parsed_at":"2022-07-19T23:17:42.101Z","dependency_job_id":null,"html_url":"https://github.com/LinZap/longpolling_room","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LinZap/longpolling_room","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinZap%2Flongpolling_room","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinZap%2Flongpolling_room/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinZap%2Flongpolling_room/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinZap%2Flongpolling_room/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LinZap","download_url":"https://codeload.github.com/LinZap/longpolling_room/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LinZap%2Flongpolling_room/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266552638,"owners_count":23947180,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-01-09T10:25:26.657Z","updated_at":"2025-07-22T18:33:50.568Z","avatar_url":"https://github.com/LinZap.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"longpolling_room\n================\n\n這是一個實作 Long polling 機制的 web 程式\n沒有多餘不相干的功能，純粹的 comet programming 基本範例\n\nLong polling 的介紹可參考這篇[詳細介紹](http://josephj.com/entry.php?id=358)\n\n\n## 程式介紹\n\n1. index.php   為主程式進入點\n2. allmsg.php \t為第一次程式進入，抓取所有訊息\n3.\tconnect.php 資料庫連接，統一函式\n4.\tlogout.php  清除 SESSION 達到登出的效果 \n5.\tlongpolling.php  程式反覆存取這隻程式，已取得最新資料，反映到畫面\n6.\tsendmsg.php  使用者藉這隻程式，將訊息傳送出去，並保存於資料庫\n7.\tsignin.php   使用者第一次需要先登入(只要求輸入姓名)\n\n\n## 資料庫 架構介紹\n\n本系統的資料庫架構十分簡易，資料表與欄位如下\n\n### Schema 介紹\n1. user (uid,name) 儲存使用者基本資料\n2. msg (id,content,send,time) 儲存使用者傳送的訊息\n3. notify (name,isnews,time) 記錄使用者抓取資料的最後時間，藉由存取該資料表，判斷是否有新資料，藉此撈取該訊息\n\n### 建立資料庫 SQL 語法\n\n    CREATE TABLE msg (  \n    \n    id int(11) NOT NULL auto_increment,  \n    \n    content varchar(500) default NULL,  \n    \n    send varchar(50) NOT NULL,  \n    \n    time datetime NOT NULL,  \n    \n    PRIMARY KEY  (id)  \n    \n    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;  \n\n* * *\n  \n    CREATE TABLE notify (  \n \n    name varchar(50) NOT NULL,  \n    \n    isnews tinyint(4) NOT NULL,  \n    \n    time datetime NOT NULL  \n    \n    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;  \n    \n* * *\n  \n    CREATE TABLE user (  \n  \n    uid int(11) NOT NULL auto_increment,  \n    \n    name varchar(50) NOT NULL,  \n    \n    PRIMARY KEY  (uid)  \n    \n    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;\n\n\n## 架構 與 Demo\n\n1. 本程式全部由 php 撰寫\n2. 資料庫使用 MySQL 5.4\n3. 後端Server位於 ueuo.com\n4. Live Demo : http://zap.comze.com/longpolling_room/\n\n\n## License\n\n   Copyright 2014 LinZap\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinzap%2Flongpolling_room","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinzap%2Flongpolling_room","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinzap%2Flongpolling_room/lists"}