{"action":"created","comment":{"url":"https://api.github.com/repos/Kinvey/js-sdk/pulls/comments/133967815","pull_request_review_id":57201810,"id":133967815,"diff_hunk":"@@ -0,0 +1,249 @@\n+import Client from '../../../client';\n+import { getLiveService } from './live-service';\n+import { KinveyRequest, RequestMethod, StatusCode } from '../../../request';\n+import { StreamACL } from './stream-acl';\n+\n+/**\n+ * @typedef MessageReceiver\n+ * @property {Function} status\n+ * @property {Function} message\n+ * @property {Function} presence\n+ */\n+\n+/**\n+ * A Stream, created in the backend\n+ * @class Stream\n+ */\n+export class Stream {\n+  /** @type {string} */\n+  name;\n+  /** @type {Client} @private */\n+  _client = Client.sharedInstance();\n+  /** @private */\n+  _liveService = getLiveService(this._client);\n+  /** @private */\n+  _subscribeChannels = {};\n+  /** @private */\n+  _publishChannels = {};\n+\n+  /**\n+   * @param {string} name\n+   */\n+  constructor(name) {\n+    this.name = name;\n+  }\n+\n+  getSubstreams() {\n+    return this._makeStreamRequest('_substreams', RequestMethod.GET);\n+  }\n+\n+  /**\n+   * Thist method sets (overwrites) the ACL for the given user's message stream\n+   * @param {string} userId The ID of the user whose stream ACL is being set\n+   * @param {StreamACL} acl The ACL object to be set\n+   * @returns {Promise}\n+   */\n+  setACL(userId, acl) {\n+    const requestBody = (acl instanceof StreamACL) ? acl.toPlainObject() : acl;\n+    return this._makeStreamRequest(userId, RequestMethod.PUT, requestBody);\n+  }\n+\n+  // Feed comm\n+\n+  /**\n+   * Subscribes the active user to the specified user's channel\n+   * @param {string} userId\n+   * @param {MessageReceiver} receiver\n+   */\n+  follow(userId, receiver) {\n+    return this._subscribe(userId, receiver);\n+  }\n+\n+  /**\n+   * Unsubscribes the active user from the specified user's channel\n+   * @param {string} userId\n+   * @returns {Promise}\n+   */\n+  unfollow(userId) {\n+    return this._unsubscribe(userId);\n+  }\n+\n+  /**\n+   * Posts a message to the active user's channel\n+   * @param {Object} message\n+   * @returns {Promise}\n+   */\n+  post(message) {\n+    const userId = this._client.activeUser._id;\n+    return this._publish(userId, message);\n+  }\n+\n+  // Directed comm\n+\n+  /**\n+   * Listens for messages sent to the active user\n+   * @param {MessageReceiver} receiver\n+   */\n+  listen(receiver) {\n+    const userId = this._client.activeUser._id;\n+    return this._subscribe(userId, receiver);\n+  }\n+\n+  /**\n+   * Stops listening for messages sent to the active user\n+   */\n+  stopListening() {","path":"src/live/src/user-to-user/stream.js","position":95,"original_position":95,"commit_id":"048e6f1e0111a1b263a30367f57483dca7caeba9","original_commit_id":"048e6f1e0111a1b263a30367f57483dca7caeba9","user":{"login":"thomasconner","id":950052,"avatar_url":"https://avatars1.githubusercontent.com/u/950052?v=4","gravatar_id":"","url":"https://api.github.com/users/thomasconner","html_url":"https://github.com/thomasconner","followers_url":"https://api.github.com/users/thomasconner/followers","following_url":"https://api.github.com/users/thomasconner/following{/other_user}","gists_url":"https://api.github.com/users/thomasconner/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasconner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasconner/subscriptions","organizations_url":"https://api.github.com/users/thomasconner/orgs","repos_url":"https://api.github.com/users/thomasconner/repos","events_url":"https://api.github.com/users/thomasconner/events{/privacy}","received_events_url":"https://api.github.com/users/thomasconner/received_events","type":"User","site_admin":false},"body":"Is this the same as calling `stream.unfollow('<userId>')`? The comment for the functions seem to indicate that they do the same thing.","created_at":"2017-08-18T14:09:21Z","updated_at":"2017-08-18T14:11:00Z","html_url":"https://github.com/Kinvey/js-sdk/pull/146#discussion_r133967815","pull_request_url":"https://api.github.com/repos/Kinvey/js-sdk/pulls/146","_links":{"self":{"href":"https://api.github.com/repos/Kinvey/js-sdk/pulls/comments/133967815"},"html":{"href":"https://github.com/Kinvey/js-sdk/pull/146#discussion_r133967815"},"pull_request":{"href":"https://api.github.com/repos/Kinvey/js-sdk/pulls/146"}}},"pull_request":{"url":"https://api.github.com/repos/Kinvey/js-sdk/pulls/146","id":136052045,"html_url":"https://github.com/Kinvey/js-sdk/pull/146","diff_url":"https://github.com/Kinvey/js-sdk/pull/146.diff","patch_url":"https://github.com/Kinvey/js-sdk/pull/146.patch","issue_url":"https://api.github.com/repos/Kinvey/js-sdk/issues/146","number":146,"state":"open","locked":false,"title":"WIP: Live service user-to-user","user":{"login":"georgiwe","id":5816340,"avatar_url":"https://avatars2.githubusercontent.com/u/5816340?v=4","gravatar_id":"","url":"https://api.github.com/users/georgiwe","html_url":"https://github.com/georgiwe","followers_url":"https://api.github.com/users/georgiwe/followers","following_url":"https://api.github.com/users/georgiwe/following{/other_user}","gists_url":"https://api.github.com/users/georgiwe/gists{/gist_id}","starred_url":"https://api.github.com/users/georgiwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgiwe/subscriptions","organizations_url":"https://api.github.com/users/georgiwe/orgs","repos_url":"https://api.github.com/users/georgiwe/repos","events_url":"https://api.github.com/users/georgiwe/events{/privacy}","received_events_url":"https://api.github.com/users/georgiwe/received_events","type":"User","site_admin":false},"body":"#### Description\r\nMLIBZ-1856 Most of the functionality is there. Some details need to be ironed out, as well as some small refactoring. Integration with the live service for collections remains - there are tickets for subtasks.\r\n\r\n#### Changes\r\nAdded classes implementing user-to-user communication.\r\n\r\n#### Tests\r\nAdded some tests for LiveService class - more to come. Some old tests fail, but I believe this is due to some fixes from master missing here. Will make sure before PR to master.\r\n","created_at":"2017-08-16T15:17:22Z","updated_at":"2017-08-18T14:11:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db7a5966c1fb1aaebb5e2c714a750370257f9c60","assignee":{"login":"georgiwe","id":5816340,"avatar_url":"https://avatars2.githubusercontent.com/u/5816340?v=4","gravatar_id":"","url":"https://api.github.com/users/georgiwe","html_url":"https://github.com/georgiwe","followers_url":"https://api.github.com/users/georgiwe/followers","following_url":"https://api.github.com/users/georgiwe/following{/other_user}","gists_url":"https://api.github.com/users/georgiwe/gists{/gist_id}","starred_url":"https://api.github.com/users/georgiwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgiwe/subscriptions","organizations_url":"https://api.github.com/users/georgiwe/orgs","repos_url":"https://api.github.com/users/georgiwe/repos","events_url":"https://api.github.com/users/georgiwe/events{/privacy}","received_events_url":"https://api.github.com/users/georgiwe/received_events","type":"User","site_admin":false},"assignees":[{"login":"georgiwe","id":5816340,"avatar_url":"https://avatars2.githubusercontent.com/u/5816340?v=4","gravatar_id":"","url":"https://api.github.com/users/georgiwe","html_url":"https://github.com/georgiwe","followers_url":"https://api.github.com/users/georgiwe/followers","following_url":"https://api.github.com/users/georgiwe/following{/other_user}","gists_url":"https://api.github.com/users/georgiwe/gists{/gist_id}","starred_url":"https://api.github.com/users/georgiwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgiwe/subscriptions","organizations_url":"https://api.github.com/users/georgiwe/orgs","repos_url":"https://api.github.com/users/georgiwe/repos","events_url":"https://api.github.com/users/georgiwe/events{/privacy}","received_events_url":"https://api.github.com/users/georgiwe/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"heyzooi","id":600503,"avatar_url":"https://avatars3.githubusercontent.com/u/600503?v=4","gravatar_id":"","url":"https://api.github.com/users/heyzooi","html_url":"https://github.com/heyzooi","followers_url":"https://api.github.com/users/heyzooi/followers","following_url":"https://api.github.com/users/heyzooi/following{/other_user}","gists_url":"https://api.github.com/users/heyzooi/gists{/gist_id}","starred_url":"https://api.github.com/users/heyzooi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heyzooi/subscriptions","organizations_url":"https://api.github.com/users/heyzooi/orgs","repos_url":"https://api.github.com/users/heyzooi/repos","events_url":"https://api.github.com/users/heyzooi/events{/privacy}","received_events_url":"https://api.github.com/users/heyzooi/received_events","type":"User","site_admin":false},{"login":"tejasranade","id":1953831,"avatar_url":"https://avatars0.githubusercontent.com/u/1953831?v=4","gravatar_id":"","url":"https://api.github.com/users/tejasranade","html_url":"https://github.com/tejasranade","followers_url":"https://api.github.com/users/tejasranade/followers","following_url":"https://api.github.com/users/tejasranade/following{/other_user}","gists_url":"https://api.github.com/users/tejasranade/gists{/gist_id}","starred_url":"https://api.github.com/users/tejasranade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tejasranade/subscriptions","organizations_url":"https://api.github.com/users/tejasranade/orgs","repos_url":"https://api.github.com/users/tejasranade/repos","events_url":"https://api.github.com/users/tejasranade/events{/privacy}","received_events_url":"https://api.github.com/users/tejasranade/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Kinvey/js-sdk/pulls/146/commits","review_comments_url":"https://api.github.com/repos/Kinvey/js-sdk/pulls/146/comments","review_comment_url":"https://api.github.com/repos/Kinvey/js-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Kinvey/js-sdk/issues/146/comments","statuses_url":"https://api.github.com/repos/Kinvey/js-sdk/statuses/048e6f1e0111a1b263a30367f57483dca7caeba9","head":{"label":"Kinvey:live-service-u2u","ref":"live-service-u2u","sha":"048e6f1e0111a1b263a30367f57483dca7caeba9","user":{"login":"Kinvey","id":1276480,"avatar_url":"https://avatars2.githubusercontent.com/u/1276480?v=4","gravatar_id":"","url":"https://api.github.com/users/Kinvey","html_url":"https://github.com/Kinvey","followers_url":"https://api.github.com/users/Kinvey/followers","following_url":"https://api.github.com/users/Kinvey/following{/other_user}","gists_url":"https://api.github.com/users/Kinvey/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinvey/subscriptions","organizations_url":"https://api.github.com/users/Kinvey/orgs","repos_url":"https://api.github.com/users/Kinvey/repos","events_url":"https://api.github.com/users/Kinvey/events{/privacy}","received_events_url":"https://api.github.com/users/Kinvey/received_events","type":"Organization","site_admin":false},"repo":{"id":30971013,"name":"js-sdk","full_name":"Kinvey/js-sdk","owner":{"login":"Kinvey","id":1276480,"avatar_url":"https://avatars2.githubusercontent.com/u/1276480?v=4","gravatar_id":"","url":"https://api.github.com/users/Kinvey","html_url":"https://github.com/Kinvey","followers_url":"https://api.github.com/users/Kinvey/followers","following_url":"https://api.github.com/users/Kinvey/following{/other_user}","gists_url":"https://api.github.com/users/Kinvey/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinvey/subscriptions","organizations_url":"https://api.github.com/users/Kinvey/orgs","repos_url":"https://api.github.com/users/Kinvey/repos","events_url":"https://api.github.com/users/Kinvey/events{/privacy}","received_events_url":"https://api.github.com/users/Kinvey/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kinvey/js-sdk","description":"JavaScript Core SDK - shared code for all Kinvey JS SDKs","fork":false,"url":"https://api.github.com/repos/Kinvey/js-sdk","forks_url":"https://api.github.com/repos/Kinvey/js-sdk/forks","keys_url":"https://api.github.com/repos/Kinvey/js-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kinvey/js-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kinvey/js-sdk/teams","hooks_url":"https://api.github.com/repos/Kinvey/js-sdk/hooks","issue_events_url":"https://api.github.com/repos/Kinvey/js-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/Kinvey/js-sdk/events","assignees_url":"https://api.github.com/repos/Kinvey/js-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/Kinvey/js-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/Kinvey/js-sdk/tags","blobs_url":"https://api.github.com/repos/Kinvey/js-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kinvey/js-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kinvey/js-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kinvey/js-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kinvey/js-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/Kinvey/js-sdk/languages","stargazers_url":"https://api.github.com/repos/Kinvey/js-sdk/stargazers","contributors_url":"https://api.github.com/repos/Kinvey/js-sdk/contributors","subscribers_url":"https://api.github.com/repos/Kinvey/js-sdk/subscribers","subscription_url":"https://api.github.com/repos/Kinvey/js-sdk/subscription","commits_url":"https://api.github.com/repos/Kinvey/js-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kinvey/js-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kinvey/js-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kinvey/js-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kinvey/js-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/Kinvey/js-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kinvey/js-sdk/merges","archive_url":"https://api.github.com/repos/Kinvey/js-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kinvey/js-sdk/downloads","issues_url":"https://api.github.com/repos/Kinvey/js-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/Kinvey/js-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/Kinvey/js-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/Kinvey/js-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kinvey/js-sdk/labels{/name}","releases_url":"https://api.github.com/repos/Kinvey/js-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/Kinvey/js-sdk/deployments","created_at":"2015-02-18T15:20:34Z","updated_at":"2017-07-07T09:38:12Z","pushed_at":"2017-08-18T13:43:47Z","git_url":"git://github.com/Kinvey/js-sdk.git","ssh_url":"git@github.com:Kinvey/js-sdk.git","clone_url":"https://github.com/Kinvey/js-sdk.git","svn_url":"https://github.com/Kinvey/js-sdk","homepage":"http://devcenter.kinvey.com","size":24174,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":6,"default_branch":"master"}},"base":{"label":"Kinvey:MLIBZ-1784_live_service","ref":"MLIBZ-1784_live_service","sha":"118ee7e4f81acde1720d483508e0b8dabf6fe30f","user":{"login":"Kinvey","id":1276480,"avatar_url":"https://avatars2.githubusercontent.com/u/1276480?v=4","gravatar_id":"","url":"https://api.github.com/users/Kinvey","html_url":"https://github.com/Kinvey","followers_url":"https://api.github.com/users/Kinvey/followers","following_url":"https://api.github.com/users/Kinvey/following{/other_user}","gists_url":"https://api.github.com/users/Kinvey/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinvey/subscriptions","organizations_url":"https://api.github.com/users/Kinvey/orgs","repos_url":"https://api.github.com/users/Kinvey/repos","events_url":"https://api.github.com/users/Kinvey/events{/privacy}","received_events_url":"https://api.github.com/users/Kinvey/received_events","type":"Organization","site_admin":false},"repo":{"id":30971013,"name":"js-sdk","full_name":"Kinvey/js-sdk","owner":{"login":"Kinvey","id":1276480,"avatar_url":"https://avatars2.githubusercontent.com/u/1276480?v=4","gravatar_id":"","url":"https://api.github.com/users/Kinvey","html_url":"https://github.com/Kinvey","followers_url":"https://api.github.com/users/Kinvey/followers","following_url":"https://api.github.com/users/Kinvey/following{/other_user}","gists_url":"https://api.github.com/users/Kinvey/gists{/gist_id}","starred_url":"https://api.github.com/users/Kinvey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kinvey/subscriptions","organizations_url":"https://api.github.com/users/Kinvey/orgs","repos_url":"https://api.github.com/users/Kinvey/repos","events_url":"https://api.github.com/users/Kinvey/events{/privacy}","received_events_url":"https://api.github.com/users/Kinvey/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kinvey/js-sdk","description":"JavaScript Core SDK - shared code for all Kinvey JS SDKs","fork":false,"url":"https://api.github.com/repos/Kinvey/js-sdk","forks_url":"https://api.github.com/repos/Kinvey/js-sdk/forks","keys_url":"https://api.github.com/repos/Kinvey/js-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kinvey/js-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kinvey/js-sdk/teams","hooks_url":"https://api.github.com/repos/Kinvey/js-sdk/hooks","issue_events_url":"https://api.github.com/repos/Kinvey/js-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/Kinvey/js-sdk/events","assignees_url":"https://api.github.com/repos/Kinvey/js-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/Kinvey/js-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/Kinvey/js-sdk/tags","blobs_url":"https://api.github.com/repos/Kinvey/js-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kinvey/js-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kinvey/js-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kinvey/js-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kinvey/js-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/Kinvey/js-sdk/languages","stargazers_url":"https://api.github.com/repos/Kinvey/js-sdk/stargazers","contributors_url":"https://api.github.com/repos/Kinvey/js-sdk/contributors","subscribers_url":"https://api.github.com/repos/Kinvey/js-sdk/subscribers","subscription_url":"https://api.github.com/repos/Kinvey/js-sdk/subscription","commits_url":"https://api.github.com/repos/Kinvey/js-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kinvey/js-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kinvey/js-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kinvey/js-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kinvey/js-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/Kinvey/js-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kinvey/js-sdk/merges","archive_url":"https://api.github.com/repos/Kinvey/js-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kinvey/js-sdk/downloads","issues_url":"https://api.github.com/repos/Kinvey/js-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/Kinvey/js-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/Kinvey/js-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/Kinvey/js-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kinvey/js-sdk/labels{/name}","releases_url":"https://api.github.com/repos/Kinvey/js-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/Kinvey/js-sdk/deployments","created_at":"2015-02-18T15:20:34Z","updated_at":"2017-07-07T09:38:12Z","pushed_at":"2017-08-18T13:43:47Z","git_url":"git://github.com/Kinvey/js-sdk.git","ssh_url":"git@github.com:Kinvey/js-sdk.git","clone_url":"https://github.com/Kinvey/js-sdk.git","svn_url":"https://github.com/Kinvey/js-sdk","homepage":"http://devcenter.kinvey.com","size":24174,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Kinvey/js-sdk/pulls/146"},"html":{"href":"https://github.com/Kinvey/js-sdk/pull/146"},"issue":{"href":"https://api.github.com/repos/Kinvey/js-sdk/issues/146"},"comments":{"href":"https://api.github.com/repos/Kinvey/js-sdk/issues/146/comments"},"review_comments":{"href":"https://api.github.com/repos/Kinvey/js-sdk/pulls/146/comments"},"review_comment":{"href":"https://api.github.com/repos/Kinvey/js-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Kinvey/js-sdk/pulls/146/commits"},"statuses":{"href":"https://api.github.com/repos/Kinvey/js-sdk/statuses/048e6f1e0111a1b263a30367f57483dca7caeba9"}}}}
{"actor":{"display_login":"thomasconner"}}