{"action":"opened","number":15,"pull_request":{"url":"https://api.github.com/repos/respoke/node-respoke-admin/pulls/15","id":88861045,"html_url":"https://github.com/respoke/node-respoke-admin/pull/15","diff_url":"https://github.com/respoke/node-respoke-admin/pull/15.diff","patch_url":"https://github.com/respoke/node-respoke-admin/pull/15.patch","issue_url":"https://api.github.com/repos/respoke/node-respoke-admin/issues/15","number":15,"state":"open","locked":false,"title":"Feature/autoreconnect with app secret","user":{"login":"ruffrey","id":1668190,"avatar_url":"https://avatars.githubusercontent.com/u/1668190?v=3","gravatar_id":"","url":"https://api.github.com/users/ruffrey","html_url":"https://github.com/ruffrey","followers_url":"https://api.github.com/users/ruffrey/followers","following_url":"https://api.github.com/users/ruffrey/following{/other_user}","gists_url":"https://api.github.com/users/ruffrey/gists{/gist_id}","starred_url":"https://api.github.com/users/ruffrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruffrey/subscriptions","organizations_url":"https://api.github.com/users/ruffrey/orgs","repos_url":"https://api.github.com/users/ruffrey/repos","events_url":"https://api.github.com/users/ruffrey/events{/privacy}","received_events_url":"https://api.github.com/users/ruffrey/received_events","type":"User","site_admin":false},"body":"After a long-ish period of respoke being unavailable (network issues on client, for example), the socket.io heartbeat/reconnect finally times out and respoke (and/or the client), will tear down the connection's session.\r\n\r\nPreviously the consumer of `respoke-admin` had to implement reconnection logic. This pull request implements opt-in automatic reconnections *when using App-Secret*.\r\n\r\nsample pseudocode reconnection, the old way:\r\n```\r\nvar respoke = new Respoke({ 'App-Secret': 'asdf-jkl' });\r\n// ...\r\nvar connectionTimeout; // returned from `setTimeout()`\r\nvar nextConnectionRetry = 1000;\r\nrespoke.auth.connect();\r\nrespoke.once('connect', function () {\r\n  // do stuff now that we are connected\r\n  // join groups, log connected, etc\r\n});\r\nrespoke.on('disconnect', function () {\r\n  // user-implemented reconnection logic\r\n  nextConnectionRetry = nextConnectionRetry * 2;\r\n  connectionTimeout = setTimeout(function () {\r\n    respoke.auth.connect();\r\n  }, nextConnectionRetry);\r\n  var connectionFailure = function (err) {\r\n     console.error('reconnection failure', err);\r\n     nextConnectionRetry = nextConnectionRetry * 2;\r\n     connectionTimeout = setTimeout(function () {\r\n        respoke.auth.connect();\r\n     }, nextConnectionRetry);\r\n  };\r\n  respoke.once('error', connectionFailure);\r\n  respoke.once('connect', function () {\r\n    // ok we connected again\r\n    // join groups, log connected, etc\r\n    clearTimeout(connectionTimeout);\r\n    connectionTimeout = null;\r\n    nextConnectionRetry = 1000;\r\n    respoke.removeEventListener('error', connectionFailure);\r\n  });\r\n});\r\n```\r\n\r\nsample reconnection, the new way:\r\n```\r\nvar Respoke = require('respoke-admin');\r\nvar respoke = new Respoke({ 'App-Secret': 'asdf-jkl', autoreconnect: true });\r\nrespoke.auth.connect();\r\nrespoke.on('connect', function () {\r\n   // join groups, log connected, etc\r\n});\r\n```","created_at":"2016-10-11T16:00:10Z","updated_at":"2016-10-11T16:00:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/respoke/node-respoke-admin/pulls/15/commits","review_comments_url":"https://api.github.com/repos/respoke/node-respoke-admin/pulls/15/comments","review_comment_url":"https://api.github.com/repos/respoke/node-respoke-admin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/respoke/node-respoke-admin/issues/15/comments","statuses_url":"https://api.github.com/repos/respoke/node-respoke-admin/statuses/6fc39faf51f4f9ab014128729dbc64be79989128","head":{"label":"respoke:feature/autoreconnect-with-app-secret","ref":"feature/autoreconnect-with-app-secret","sha":"6fc39faf51f4f9ab014128729dbc64be79989128","user":{"login":"respoke","id":7663021,"avatar_url":"https://avatars.githubusercontent.com/u/7663021?v=3","gravatar_id":"","url":"https://api.github.com/users/respoke","html_url":"https://github.com/respoke","followers_url":"https://api.github.com/users/respoke/followers","following_url":"https://api.github.com/users/respoke/following{/other_user}","gists_url":"https://api.github.com/users/respoke/gists{/gist_id}","starred_url":"https://api.github.com/users/respoke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/respoke/subscriptions","organizations_url":"https://api.github.com/users/respoke/orgs","repos_url":"https://api.github.com/users/respoke/repos","events_url":"https://api.github.com/users/respoke/events{/privacy}","received_events_url":"https://api.github.com/users/respoke/received_events","type":"Organization","site_admin":false},"repo":{"id":23157533,"name":"node-respoke-admin","full_name":"respoke/node-respoke-admin","owner":{"login":"respoke","id":7663021,"avatar_url":"https://avatars.githubusercontent.com/u/7663021?v=3","gravatar_id":"","url":"https://api.github.com/users/respoke","html_url":"https://github.com/respoke","followers_url":"https://api.github.com/users/respoke/followers","following_url":"https://api.github.com/users/respoke/following{/other_user}","gists_url":"https://api.github.com/users/respoke/gists{/gist_id}","starred_url":"https://api.github.com/users/respoke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/respoke/subscriptions","organizations_url":"https://api.github.com/users/respoke/orgs","repos_url":"https://api.github.com/users/respoke/repos","events_url":"https://api.github.com/users/respoke/events{/privacy}","received_events_url":"https://api.github.com/users/respoke/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/respoke/node-respoke-admin","description":"This is the Node.js library that wraps the HTTP and WebSocket API provided by Respoke.","fork":false,"url":"https://api.github.com/repos/respoke/node-respoke-admin","forks_url":"https://api.github.com/repos/respoke/node-respoke-admin/forks","keys_url":"https://api.github.com/repos/respoke/node-respoke-admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/respoke/node-respoke-admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/respoke/node-respoke-admin/teams","hooks_url":"https://api.github.com/repos/respoke/node-respoke-admin/hooks","issue_events_url":"https://api.github.com/repos/respoke/node-respoke-admin/issues/events{/number}","events_url":"https://api.github.com/repos/respoke/node-respoke-admin/events","assignees_url":"https://api.github.com/repos/respoke/node-respoke-admin/assignees{/user}","branches_url":"https://api.github.com/repos/respoke/node-respoke-admin/branches{/branch}","tags_url":"https://api.github.com/repos/respoke/node-respoke-admin/tags","blobs_url":"https://api.github.com/repos/respoke/node-respoke-admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/respoke/node-respoke-admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/respoke/node-respoke-admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/respoke/node-respoke-admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/respoke/node-respoke-admin/statuses/{sha}","languages_url":"https://api.github.com/repos/respoke/node-respoke-admin/languages","stargazers_url":"https://api.github.com/repos/respoke/node-respoke-admin/stargazers","contributors_url":"https://api.github.com/repos/respoke/node-respoke-admin/contributors","subscribers_url":"https://api.github.com/repos/respoke/node-respoke-admin/subscribers","subscription_url":"https://api.github.com/repos/respoke/node-respoke-admin/subscription","commits_url":"https://api.github.com/repos/respoke/node-respoke-admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/respoke/node-respoke-admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/respoke/node-respoke-admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/respoke/node-respoke-admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/respoke/node-respoke-admin/contents/{+path}","compare_url":"https://api.github.com/repos/respoke/node-respoke-admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/respoke/node-respoke-admin/merges","archive_url":"https://api.github.com/repos/respoke/node-respoke-admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/respoke/node-respoke-admin/downloads","issues_url":"https://api.github.com/repos/respoke/node-respoke-admin/issues{/number}","pulls_url":"https://api.github.com/repos/respoke/node-respoke-admin/pulls{/number}","milestones_url":"https://api.github.com/repos/respoke/node-respoke-admin/milestones{/number}","notifications_url":"https://api.github.com/repos/respoke/node-respoke-admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/respoke/node-respoke-admin/labels{/name}","releases_url":"https://api.github.com/repos/respoke/node-respoke-admin/releases{/id}","deployments_url":"https://api.github.com/repos/respoke/node-respoke-admin/deployments","created_at":"2014-08-20T17:29:55Z","updated_at":"2016-03-01T15:52:34Z","pushed_at":"2016-10-11T16:00:10Z","git_url":"git://github.com/respoke/node-respoke-admin.git","ssh_url":"git@github.com:respoke/node-respoke-admin.git","clone_url":"https://github.com/respoke/node-respoke-admin.git","svn_url":"https://github.com/respoke/node-respoke-admin","homepage":"https://docs.respoke.io","size":523,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":6,"default_branch":"master"}},"base":{"label":"respoke:master","ref":"master","sha":"cac2f3dad8977741e3ac451d16e3fd60de2b12f3","user":{"login":"respoke","id":7663021,"avatar_url":"https://avatars.githubusercontent.com/u/7663021?v=3","gravatar_id":"","url":"https://api.github.com/users/respoke","html_url":"https://github.com/respoke","followers_url":"https://api.github.com/users/respoke/followers","following_url":"https://api.github.com/users/respoke/following{/other_user}","gists_url":"https://api.github.com/users/respoke/gists{/gist_id}","starred_url":"https://api.github.com/users/respoke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/respoke/subscriptions","organizations_url":"https://api.github.com/users/respoke/orgs","repos_url":"https://api.github.com/users/respoke/repos","events_url":"https://api.github.com/users/respoke/events{/privacy}","received_events_url":"https://api.github.com/users/respoke/received_events","type":"Organization","site_admin":false},"repo":{"id":23157533,"name":"node-respoke-admin","full_name":"respoke/node-respoke-admin","owner":{"login":"respoke","id":7663021,"avatar_url":"https://avatars.githubusercontent.com/u/7663021?v=3","gravatar_id":"","url":"https://api.github.com/users/respoke","html_url":"https://github.com/respoke","followers_url":"https://api.github.com/users/respoke/followers","following_url":"https://api.github.com/users/respoke/following{/other_user}","gists_url":"https://api.github.com/users/respoke/gists{/gist_id}","starred_url":"https://api.github.com/users/respoke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/respoke/subscriptions","organizations_url":"https://api.github.com/users/respoke/orgs","repos_url":"https://api.github.com/users/respoke/repos","events_url":"https://api.github.com/users/respoke/events{/privacy}","received_events_url":"https://api.github.com/users/respoke/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/respoke/node-respoke-admin","description":"This is the Node.js library that wraps the HTTP and WebSocket API provided by Respoke.","fork":false,"url":"https://api.github.com/repos/respoke/node-respoke-admin","forks_url":"https://api.github.com/repos/respoke/node-respoke-admin/forks","keys_url":"https://api.github.com/repos/respoke/node-respoke-admin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/respoke/node-respoke-admin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/respoke/node-respoke-admin/teams","hooks_url":"https://api.github.com/repos/respoke/node-respoke-admin/hooks","issue_events_url":"https://api.github.com/repos/respoke/node-respoke-admin/issues/events{/number}","events_url":"https://api.github.com/repos/respoke/node-respoke-admin/events","assignees_url":"https://api.github.com/repos/respoke/node-respoke-admin/assignees{/user}","branches_url":"https://api.github.com/repos/respoke/node-respoke-admin/branches{/branch}","tags_url":"https://api.github.com/repos/respoke/node-respoke-admin/tags","blobs_url":"https://api.github.com/repos/respoke/node-respoke-admin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/respoke/node-respoke-admin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/respoke/node-respoke-admin/git/refs{/sha}","trees_url":"https://api.github.com/repos/respoke/node-respoke-admin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/respoke/node-respoke-admin/statuses/{sha}","languages_url":"https://api.github.com/repos/respoke/node-respoke-admin/languages","stargazers_url":"https://api.github.com/repos/respoke/node-respoke-admin/stargazers","contributors_url":"https://api.github.com/repos/respoke/node-respoke-admin/contributors","subscribers_url":"https://api.github.com/repos/respoke/node-respoke-admin/subscribers","subscription_url":"https://api.github.com/repos/respoke/node-respoke-admin/subscription","commits_url":"https://api.github.com/repos/respoke/node-respoke-admin/commits{/sha}","git_commits_url":"https://api.github.com/repos/respoke/node-respoke-admin/git/commits{/sha}","comments_url":"https://api.github.com/repos/respoke/node-respoke-admin/comments{/number}","issue_comment_url":"https://api.github.com/repos/respoke/node-respoke-admin/issues/comments{/number}","contents_url":"https://api.github.com/repos/respoke/node-respoke-admin/contents/{+path}","compare_url":"https://api.github.com/repos/respoke/node-respoke-admin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/respoke/node-respoke-admin/merges","archive_url":"https://api.github.com/repos/respoke/node-respoke-admin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/respoke/node-respoke-admin/downloads","issues_url":"https://api.github.com/repos/respoke/node-respoke-admin/issues{/number}","pulls_url":"https://api.github.com/repos/respoke/node-respoke-admin/pulls{/number}","milestones_url":"https://api.github.com/repos/respoke/node-respoke-admin/milestones{/number}","notifications_url":"https://api.github.com/repos/respoke/node-respoke-admin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/respoke/node-respoke-admin/labels{/name}","releases_url":"https://api.github.com/repos/respoke/node-respoke-admin/releases{/id}","deployments_url":"https://api.github.com/repos/respoke/node-respoke-admin/deployments","created_at":"2014-08-20T17:29:55Z","updated_at":"2016-03-01T15:52:34Z","pushed_at":"2016-10-11T16:00:10Z","git_url":"git://github.com/respoke/node-respoke-admin.git","ssh_url":"git@github.com:respoke/node-respoke-admin.git","clone_url":"https://github.com/respoke/node-respoke-admin.git","svn_url":"https://github.com/respoke/node-respoke-admin","homepage":"https://docs.respoke.io","size":523,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/respoke/node-respoke-admin/pulls/15"},"html":{"href":"https://github.com/respoke/node-respoke-admin/pull/15"},"issue":{"href":"https://api.github.com/repos/respoke/node-respoke-admin/issues/15"},"comments":{"href":"https://api.github.com/repos/respoke/node-respoke-admin/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/respoke/node-respoke-admin/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/respoke/node-respoke-admin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/respoke/node-respoke-admin/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/respoke/node-respoke-admin/statuses/6fc39faf51f4f9ab014128729dbc64be79989128"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":3,"additions":419,"deletions":12,"changed_files":4}}
{"actor":{"display_login":"ruffrey"}}