{"id":19614833,"url":"https://github.com/leancloud/leanmessage-demo","last_synced_at":"2025-04-05T15:10:00.444Z","repository":{"id":32086270,"uuid":"35658301","full_name":"leancloud/leanmessage-demo","owner":"leancloud","description":"使用 LeanCloud 实时通讯搭建的聊天 WebApp","archived":false,"fork":false,"pushed_at":"2023-01-23T22:25:09.000Z","size":2266,"stargazers_count":326,"open_issues_count":23,"forks_count":111,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-03-29T14:12:48.304Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://leanmessage.leanapp.cn","language":"JavaScript","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/leancloud.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":"2015-05-15T06:44:59.000Z","updated_at":"2025-02-23T12:02:51.000Z","dependencies_parsed_at":"2023-02-13T04:05:28.118Z","dependency_job_id":null,"html_url":"https://github.com/leancloud/leanmessage-demo","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/leancloud%2Fleanmessage-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leancloud%2Fleanmessage-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leancloud%2Fleanmessage-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leancloud%2Fleanmessage-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leancloud","download_url":"https://codeload.github.com/leancloud/leanmessage-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353749,"owners_count":20925329,"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-11T10:54:06.337Z","updated_at":"2025-04-05T15:10:00.427Z","avatar_url":"https://github.com/leancloud.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"LeanMessage WebApp\n====\n\n使用 LeanCloud 实时通讯搭建的聊天 WebApp。[Live Demo](https://leanmessage.leanapp.cn/)\n\n\u003e 在找 iOS/Android Demo？[iOS](https://github.com/leancloud/swift-sdk-demo)、[Android](https://github.com/leancloud/LeanCloudChatKit-Android)。\n\n### 功能\n\n- [x] 登录\n- [x] 聊天室、单聊、群聊\n- [x] 系统对话实现的聊天机器人\n- [x] 成员管理\n  - [x] 邀请、移除成员\n  - [x] 提升、撤销管理员\n- [x] 群名称修改\n- [x] 消息送达回执与已读回执\n- [x] 未读消息\n- [x] 「正在输入」状态\n- [x] 消息撤回\n- [x] 图片消息\n- [x] 提及（@）对话成员\n- [x] 表情\n  - [x] 小表情（Emoji）\n  - [x] 大表情（Sticker）\n\n### 文档\n\n[即时通讯开发指南](https://leancloud.cn/docs/realtime_v2.html)\n\n### 本地开发、调试\n\n\n1. `yarn`\n2. `yarn serve`\n3. `open http://localhost:3000/`\n\n### 部署\n\n\n1. 运行 `yarn build` 生成 dist 目录\n2. 将 dist 目录作为静态资源部署\n\n实时通讯服务是通过校验 origin 来保证安全的，项目中默认的 AppID 是 LeanCloud 提供的测试 App 的 ID，仅允许 localhost:3000 来源的访问，当你需要在另外的域名上部署 LeanMessage WebApp 时，需要将 src/index.js 中的 appId 改为你的 LeanCloud 项目的 App ID，并且确认设置了你的域名为该项目的「安全域名」，更多关于安全方面的信息请参考 [Web 安全域名](https://leancloud.cn/docs/data_security.html#Web_安全域名)。\n\n### 代码结构与功能\n\n```\nsrc/\n├── app\n│   ├── components      // 组件\n│   │   ├── message                 // 消息 directive\n│   │   ├── reverse-infinite-list   // 向上滚动无限加载列表 directive\n│   │   └── user                    // 用户相关 service\n│   ├── conversation    // 会话 view，app 主界面\n│   │   └── conversationMessage     // 消息 view，会话 view 的子 view\n│   └── login           // 登录 view\n├── index.html          // 页面入口，ui-view 容器\n├── index.js            // js 入口，注册依赖模块，启动 app\n├── index.run.js        // 启动 app 的代码\n├── index.scss\n└── routes.js           // 配置路由\n```\n![leanmessage-views](https://cloud.githubusercontent.com/assets/175227/9702711/598c3390-549d-11e5-86c7-32595fbb9013.png)\n\n#### index.js\njs 入口，申明依赖模块，配置依赖模块，注册 components 与 views，启动 app。\n依赖的 LeanCloud 模块有:\n- [leancloud-realtime](https://leancloud.cn/docs/realtime_guide-js.html)\n\n依赖的 angular 模块有：\n- [ui.router](https://github.com/angular-ui/ui-router)：基于状态的 router\n- [ngMaterial](https://material.angularjs.org/)：提供 material design UI 组件\n\n#### routes.js\n配置 ui.router\n\n#### index.run.js\n启动 app 的脚本，通过监听 ui.router 的 `stateChangeStart` 事件在视图切换时检查用户登录状态。\n\n### How to\n\n#### 实现用户系统\n为了方便与其他系统对接，LeanMessage 服务没有内建用户系统，只有作为唯一标识的 [clientId](https://leancloud.cn/docs/realtime_v2.html#clientId)，你需要在你的用户系统中维护用户与 clientId 的关系。你可以使用 LeanStorage 提供的[「用户系统」](https://leancloud.cn/docs/js_guide.html#用户)。\n本 demo 中没有关联用户系统，可以用任何的 id 登录服务。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleancloud%2Fleanmessage-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleancloud%2Fleanmessage-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleancloud%2Fleanmessage-demo/lists"}