aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Barbieri <bruno.barbieri@consensys.net>2019-08-07 03:33:41 +0800
committerGitHub <noreply@github.com>2019-08-07 03:33:41 +0800
commit835d4fbb139185a0026a24bb2f25ae55d7ee2baf (patch)
treefd408b5d79befb5cd7e59e513365e0fec2e69891
parent3136dd39eaed13a32bd4aa54415842e75bb8a2bd (diff)
downloadtangerine-wallet-browser-835d4fbb139185a0026a24bb2f25ae55d7ee2baf.tar.gz
tangerine-wallet-browser-835d4fbb139185a0026a24bb2f25ae55d7ee2baf.tar.zst
tangerine-wallet-browser-835d4fbb139185a0026a24bb2f25ae55d7ee2baf.zip
Update mobile sync (#6967)
* update mobile sync * update lockfile
-rw-r--r--package.json2
-rw-r--r--ui/app/pages/mobile-sync/index.js11
-rw-r--r--yarn.lock8
3 files changed, 13 insertions, 8 deletions
diff --git a/package.json b/package.json
index 354f50013..22e94e3b9 100644
--- a/package.json
+++ b/package.json
@@ -126,7 +126,7 @@
"promise-filter": "^1.1.0",
"promise-to-callback": "^1.0.0",
"prop-types": "^15.6.1",
- "pubnub": "^4.21.5",
+ "pubnub": "4.24.4",
"pump": "^3.0.0",
"qrcode-generator": "1.4.1",
"ramda": "^0.24.1",
diff --git a/ui/app/pages/mobile-sync/index.js b/ui/app/pages/mobile-sync/index.js
index 7fc3b540b..bd2385808 100644
--- a/ui/app/pages/mobile-sync/index.js
+++ b/ui/app/pages/mobile-sync/index.js
@@ -84,6 +84,9 @@ class MobileSyncPage extends Component {
}
initWebsockets () {
+ // Make sure there are no existing listeners
+ this.disconnectWebsockets()
+
this.pubnub = new PubNub({
subscribeKey: process.env.PUBNUB_SUB_KEY,
publishKey: process.env.PUBNUB_PUB_KEY,
@@ -91,7 +94,7 @@ class MobileSyncPage extends Component {
ssl: true,
})
- this.pubnubListener = this.pubnub.addListener({
+ this.pubnubListener = {
message: (data) => {
const {channel, message} = data
// handle message
@@ -111,7 +114,9 @@ class MobileSyncPage extends Component {
this.setState({syncing: false, completed: true})
}
},
- })
+ }
+
+ this.pubnub.addListener(this.pubnubListener)
this.pubnub.subscribe({
channels: [this.channelName],
@@ -122,7 +127,7 @@ class MobileSyncPage extends Component {
disconnectWebsockets () {
if (this.pubnub && this.pubnubListener) {
- this.pubnub.disconnect(this.pubnubListener)
+ this.pubnub.removeListener(this.pubnubListener)
}
}
diff --git a/yarn.lock b/yarn.lock
index a8e1b1f94..c19a6be1b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -17150,10 +17150,10 @@ public-encrypt@^4.0.0:
parse-asn1 "^5.0.0"
randombytes "^2.0.1"
-pubnub@^4.21.5:
- version "4.21.7"
- resolved "https://registry.yarnpkg.com/pubnub/-/pubnub-4.21.7.tgz#4daf999ead1aa9cf8e9af3d2fb2720c35085af6a"
- integrity sha512-TZ96GuY+gZIu9rJaqcO2cZ6tl4JPLruoUcN01sljm1CcDgzIZbOfcDSZp4NcZas4ECSqAAwo/izMMiImRRS4Yg==
+pubnub@4.24.4:
+ version "4.24.4"
+ resolved "https://registry.yarnpkg.com/pubnub/-/pubnub-4.24.4.tgz#6874b1836539765a1c1ec8c264f6b233ed28192a"
+ integrity sha512-otRny/9au/Xf0uAfPUrVwUPdFIE7nZv6+7TLcG8+wiZESgi7EgiGZ9VXAoe6istBj6hfZe0vj3+XCbkZHLHklw==
dependencies:
agentkeepalive "^3.5.2"
lil-uuid "^0.1.1"