{"action":"created","comment":{"url":"https://api.github.com/repos/leancloud/docs/pulls/comments/212858998","pull_request_review_id":149573165,"id":212858998,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjg1ODk5OA==","diff_hunk":"@@ -0,0 +1,598 @@\n+{% import \"views/_helper.njk\" as docs %}\n+{% import \"views/_im.njk\" as im %}\n+\n+# 即时通讯开发指南 &middot; 基础入门\n+\n+## 应用场景和需求\n+\n+针对如下应用场景，即时通讯都有对应的解决方案：\n+\n+- 社交应用需要接入聊天功能\n+- 游戏需要接入聊天频道\n+- 直播应用要接入聊天室弹幕服务\n+- 系统广播消息在线通知，游戏 GM 在线全服广播\n+\n+而上述只是一些比较经典和流行的场景，即时通讯不局限于上述用法和场景，我们提供的易用性支持开发者可以拓展更多的场景和模式。\n+\n+即时通讯要解决的核心需求就是:\n+\n+> 让你的应用/软件/网站/小程序/游戏拥有私聊/群聊/聊天室/系统消息等通讯能力\n+\n+\n+\b即时通讯使得开发者可以在不编写服务端的代码的情况下，仅使用客户端 SDK 即可实现在线聊天/多人群组/私聊/消息群发等实时通讯的功能，如下时序图简单的介绍了一下即时通讯的业务流程：\n+\n+![rtm-message-seq](images/rtm-message-seq.svg)\n+\n+\n+首先，如果您还没有下载对应开发环境（语言）的 SDK，请查看如下内容，选择一门语言，查看下载和安装的文档：\n+\n+- [JavaScript](sdk_setup-js.html)\n+- [iOS-Objective-C](sdk_setup-objc.html)\n+- [Android-Java](sdk_setup-android.html)\n+- [Unity3D-C#](sdk_setup-dotnet.html)\n+\n+\n+## 一对一单聊\n+我们从最基本的一对一私聊开始接入即时通讯模块，首先我们需要明确一个需求：\n+\n+> 假设我们正在制作一个社交聊天的应用，第一步要实现一个用户向另一个用户发起聊天的功能\n+\n+首先我们需要介绍一下在即时通讯服务中的  `AVIMClient` 对象：\n+\n+> `AVIMClient` 对应实体的是一个用户，它表示一个用户以客户端的身份登录到整个即时通讯的系统。\n+\n+\n+### 1.创建 AVIMClient\n+\n+在 iOS 和 Android SDK 中使用如下代码创建出一个 `AVIMClient`:\n+\n+```objc\n+@property (nonatomic, strong) AVIMClient *client;\n+// clientId 为 Tom\n+self.client = [[AVIMClient alloc] initWithClientId:@\"Tom\"]\n+```\n+```java\n+// clientId 为 Tom\n+AVIMClient tom = AVIMClient.getInstance(\"Tom\");\n+```\n+\n+示例代码中 `clientId` 被设置为 Tom, 这里我们需要明确一下 `clientId` 的约束：\n+\n+1. 它必须为一个字符串\n+2. 在一个应用内全局唯一\n+3. 长度不能超过 128 个字符","path":"views/realtime-guide-beginner.md","position":63,"original_position":63,"commit_id":"00324c2e756d0eb7314d3ec9c724e6790fc361f2","original_commit_id":"00324c2e756d0eb7314d3ec9c724e6790fc361f2","user":{"login":"jwfing","id":985038,"node_id":"MDQ6VXNlcjk4NTAzOA==","avatar_url":"https://avatars2.githubusercontent.com/u/985038?v=4","gravatar_id":"","url":"https://api.github.com/users/jwfing","html_url":"https://github.com/jwfing","followers_url":"https://api.github.com/users/jwfing/followers","following_url":"https://api.github.com/users/jwfing/following{/other_user}","gists_url":"https://api.github.com/users/jwfing/gists{/gist_id}","starred_url":"https://api.github.com/users/jwfing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwfing/subscriptions","organizations_url":"https://api.github.com/users/jwfing/orgs","repos_url":"https://api.github.com/users/jwfing/repos","events_url":"https://api.github.com/users/jwfing/events{/privacy}","received_events_url":"https://api.github.com/users/jwfing/received_events","type":"User","site_admin":false},"body":"128 还是 64，需要确认清楚。","created_at":"2018-08-27T03:34:33Z","updated_at":"2018-08-27T03:34:33Z","html_url":"https://github.com/leancloud/docs/pull/2693#discussion_r212858998","pull_request_url":"https://api.github.com/repos/leancloud/docs/pulls/2693","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/leancloud/docs/pulls/comments/212858998"},"html":{"href":"https://github.com/leancloud/docs/pull/2693#discussion_r212858998"},"pull_request":{"href":"https://api.github.com/repos/leancloud/docs/pulls/2693"}}},"pull_request":{"url":"https://api.github.com/repos/leancloud/docs/pulls/2693","id":210366373,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwMzY2Mzcz","html_url":"https://github.com/leancloud/docs/pull/2693","diff_url":"https://github.com/leancloud/docs/pull/2693.diff","patch_url":"https://github.com/leancloud/docs/pull/2693.patch","issue_url":"https://api.github.com/repos/leancloud/docs/issues/2693","number":2693,"state":"open","locked":false,"title":"Rtm v3 beginner preview","user":{"login":"wujun4code","id":5119542,"node_id":"MDQ6VXNlcjUxMTk1NDI=","avatar_url":"https://avatars2.githubusercontent.com/u/5119542?v=4","gravatar_id":"","url":"https://api.github.com/users/wujun4code","html_url":"https://github.com/wujun4code","followers_url":"https://api.github.com/users/wujun4code/followers","following_url":"https://api.github.com/users/wujun4code/following{/other_user}","gists_url":"https://api.github.com/users/wujun4code/gists{/gist_id}","starred_url":"https://api.github.com/users/wujun4code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wujun4code/subscriptions","organizations_url":"https://api.github.com/users/wujun4code/orgs","repos_url":"https://api.github.com/users/wujun4code/repos","events_url":"https://api.github.com/users/wujun4code/events{/privacy}","received_events_url":"https://api.github.com/users/wujun4code/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-23T08:18:42Z","updated_at":"2018-08-27T03:34:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6758a53b2da61225881581b3ba9fb140d9815387","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/leancloud/docs/pulls/2693/commits","review_comments_url":"https://api.github.com/repos/leancloud/docs/pulls/2693/comments","review_comment_url":"https://api.github.com/repos/leancloud/docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/leancloud/docs/issues/2693/comments","statuses_url":"https://api.github.com/repos/leancloud/docs/statuses/00324c2e756d0eb7314d3ec9c724e6790fc361f2","head":{"label":"wujun4code:rtm-v3-beginner-preview","ref":"rtm-v3-beginner-preview","sha":"00324c2e756d0eb7314d3ec9c724e6790fc361f2","user":{"login":"wujun4code","id":5119542,"node_id":"MDQ6VXNlcjUxMTk1NDI=","avatar_url":"https://avatars2.githubusercontent.com/u/5119542?v=4","gravatar_id":"","url":"https://api.github.com/users/wujun4code","html_url":"https://github.com/wujun4code","followers_url":"https://api.github.com/users/wujun4code/followers","following_url":"https://api.github.com/users/wujun4code/following{/other_user}","gists_url":"https://api.github.com/users/wujun4code/gists{/gist_id}","starred_url":"https://api.github.com/users/wujun4code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wujun4code/subscriptions","organizations_url":"https://api.github.com/users/wujun4code/orgs","repos_url":"https://api.github.com/users/wujun4code/repos","events_url":"https://api.github.com/users/wujun4code/events{/privacy}","received_events_url":"https://api.github.com/users/wujun4code/received_events","type":"User","site_admin":false},"repo":{"id":29326977,"node_id":"MDEwOlJlcG9zaXRvcnkyOTMyNjk3Nw==","name":"docs","full_name":"wujun4code/docs","owner":{"login":"wujun4code","id":5119542,"node_id":"MDQ6VXNlcjUxMTk1NDI=","avatar_url":"https://avatars2.githubusercontent.com/u/5119542?v=4","gravatar_id":"","url":"https://api.github.com/users/wujun4code","html_url":"https://github.com/wujun4code","followers_url":"https://api.github.com/users/wujun4code/followers","following_url":"https://api.github.com/users/wujun4code/following{/other_user}","gists_url":"https://api.github.com/users/wujun4code/gists{/gist_id}","starred_url":"https://api.github.com/users/wujun4code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wujun4code/subscriptions","organizations_url":"https://api.github.com/users/wujun4code/orgs","repos_url":"https://api.github.com/users/wujun4code/repos","events_url":"https://api.github.com/users/wujun4code/events{/privacy}","received_events_url":"https://api.github.com/users/wujun4code/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wujun4code/docs","description":"LeanCloud Documentation","fork":true,"url":"https://api.github.com/repos/wujun4code/docs","forks_url":"https://api.github.com/repos/wujun4code/docs/forks","keys_url":"https://api.github.com/repos/wujun4code/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wujun4code/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wujun4code/docs/teams","hooks_url":"https://api.github.com/repos/wujun4code/docs/hooks","issue_events_url":"https://api.github.com/repos/wujun4code/docs/issues/events{/number}","events_url":"https://api.github.com/repos/wujun4code/docs/events","assignees_url":"https://api.github.com/repos/wujun4code/docs/assignees{/user}","branches_url":"https://api.github.com/repos/wujun4code/docs/branches{/branch}","tags_url":"https://api.github.com/repos/wujun4code/docs/tags","blobs_url":"https://api.github.com/repos/wujun4code/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wujun4code/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wujun4code/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/wujun4code/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wujun4code/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/wujun4code/docs/languages","stargazers_url":"https://api.github.com/repos/wujun4code/docs/stargazers","contributors_url":"https://api.github.com/repos/wujun4code/docs/contributors","subscribers_url":"https://api.github.com/repos/wujun4code/docs/subscribers","subscription_url":"https://api.github.com/repos/wujun4code/docs/subscription","commits_url":"https://api.github.com/repos/wujun4code/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/wujun4code/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/wujun4code/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/wujun4code/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/wujun4code/docs/contents/{+path}","compare_url":"https://api.github.com/repos/wujun4code/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wujun4code/docs/merges","archive_url":"https://api.github.com/repos/wujun4code/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wujun4code/docs/downloads","issues_url":"https://api.github.com/repos/wujun4code/docs/issues{/number}","pulls_url":"https://api.github.com/repos/wujun4code/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/wujun4code/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/wujun4code/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wujun4code/docs/labels{/name}","releases_url":"https://api.github.com/repos/wujun4code/docs/releases{/id}","deployments_url":"https://api.github.com/repos/wujun4code/docs/deployments","created_at":"2015-01-16T01:31:32Z","updated_at":"2016-04-12T06:46:28Z","pushed_at":"2018-08-24T16:28:14Z","git_url":"git://github.com/wujun4code/docs.git","ssh_url":"git@github.com:wujun4code/docs.git","clone_url":"https://github.com/wujun4code/docs.git","svn_url":"https://github.com/wujun4code/docs","homepage":"http://leancloud.cn/docs/","size":68522,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"leancloud:master","ref":"master","sha":"508e67c94a22505738c344c065e5a3d4bba9344d","user":{"login":"leancloud","id":6660518,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2NjA1MTg=","avatar_url":"https://avatars2.githubusercontent.com/u/6660518?v=4","gravatar_id":"","url":"https://api.github.com/users/leancloud","html_url":"https://github.com/leancloud","followers_url":"https://api.github.com/users/leancloud/followers","following_url":"https://api.github.com/users/leancloud/following{/other_user}","gists_url":"https://api.github.com/users/leancloud/gists{/gist_id}","starred_url":"https://api.github.com/users/leancloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leancloud/subscriptions","organizations_url":"https://api.github.com/users/leancloud/orgs","repos_url":"https://api.github.com/users/leancloud/repos","events_url":"https://api.github.com/users/leancloud/events{/privacy}","received_events_url":"https://api.github.com/users/leancloud/received_events","type":"Organization","site_admin":false},"repo":{"id":25067518,"node_id":"MDEwOlJlcG9zaXRvcnkyNTA2NzUxOA==","name":"docs","full_name":"leancloud/docs","owner":{"login":"leancloud","id":6660518,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY2NjA1MTg=","avatar_url":"https://avatars2.githubusercontent.com/u/6660518?v=4","gravatar_id":"","url":"https://api.github.com/users/leancloud","html_url":"https://github.com/leancloud","followers_url":"https://api.github.com/users/leancloud/followers","following_url":"https://api.github.com/users/leancloud/following{/other_user}","gists_url":"https://api.github.com/users/leancloud/gists{/gist_id}","starred_url":"https://api.github.com/users/leancloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leancloud/subscriptions","organizations_url":"https://api.github.com/users/leancloud/orgs","repos_url":"https://api.github.com/users/leancloud/repos","events_url":"https://api.github.com/users/leancloud/events{/privacy}","received_events_url":"https://api.github.com/users/leancloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/leancloud/docs","description":"LeanCloud Documentation","fork":false,"url":"https://api.github.com/repos/leancloud/docs","forks_url":"https://api.github.com/repos/leancloud/docs/forks","keys_url":"https://api.github.com/repos/leancloud/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leancloud/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leancloud/docs/teams","hooks_url":"https://api.github.com/repos/leancloud/docs/hooks","issue_events_url":"https://api.github.com/repos/leancloud/docs/issues/events{/number}","events_url":"https://api.github.com/repos/leancloud/docs/events","assignees_url":"https://api.github.com/repos/leancloud/docs/assignees{/user}","branches_url":"https://api.github.com/repos/leancloud/docs/branches{/branch}","tags_url":"https://api.github.com/repos/leancloud/docs/tags","blobs_url":"https://api.github.com/repos/leancloud/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leancloud/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leancloud/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/leancloud/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leancloud/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/leancloud/docs/languages","stargazers_url":"https://api.github.com/repos/leancloud/docs/stargazers","contributors_url":"https://api.github.com/repos/leancloud/docs/contributors","subscribers_url":"https://api.github.com/repos/leancloud/docs/subscribers","subscription_url":"https://api.github.com/repos/leancloud/docs/subscription","commits_url":"https://api.github.com/repos/leancloud/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/leancloud/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/leancloud/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/leancloud/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/leancloud/docs/contents/{+path}","compare_url":"https://api.github.com/repos/leancloud/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leancloud/docs/merges","archive_url":"https://api.github.com/repos/leancloud/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leancloud/docs/downloads","issues_url":"https://api.github.com/repos/leancloud/docs/issues{/number}","pulls_url":"https://api.github.com/repos/leancloud/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/leancloud/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/leancloud/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leancloud/docs/labels{/name}","releases_url":"https://api.github.com/repos/leancloud/docs/releases{/id}","deployments_url":"https://api.github.com/repos/leancloud/docs/deployments","created_at":"2014-10-11T07:14:37Z","updated_at":"2018-08-23T08:16:04Z","pushed_at":"2018-08-24T16:28:16Z","git_url":"git://github.com/leancloud/docs.git","ssh_url":"git@github.com:leancloud/docs.git","clone_url":"https://github.com/leancloud/docs.git","svn_url":"https://github.com/leancloud/docs","homepage":"https://leancloud.cn/docs/","size":68417,"stargazers_count":499,"watchers_count":499,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":255,"mirror_url":null,"archived":false,"open_issues_count":80,"license":{"key":"lgpl-3.0","name":"GNU Lesser General Public License v3.0","spdx_id":"LGPL-3.0","url":"https://api.github.com/licenses/lgpl-3.0","node_id":"MDc6TGljZW5zZTEy"},"forks":255,"open_issues":80,"watchers":499,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/leancloud/docs/pulls/2693"},"html":{"href":"https://github.com/leancloud/docs/pull/2693"},"issue":{"href":"https://api.github.com/repos/leancloud/docs/issues/2693"},"comments":{"href":"https://api.github.com/repos/leancloud/docs/issues/2693/comments"},"review_comments":{"href":"https://api.github.com/repos/leancloud/docs/pulls/2693/comments"},"review_comment":{"href":"https://api.github.com/repos/leancloud/docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/leancloud/docs/pulls/2693/commits"},"statuses":{"href":"https://api.github.com/repos/leancloud/docs/statuses/00324c2e756d0eb7314d3ec9c724e6790fc361f2"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jwfing"}}