aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app
diff options
context:
space:
mode:
authorMark Stacey <markjstacey@gmail.com>2019-08-07 04:09:15 +0800
committerMark Stacey <markjstacey@gmail.com>2019-08-07 04:09:15 +0800
commit232600d928724b7ea8f92bdca55ee0f5001a5df7 (patch)
tree1215b7af7c4e4d360b6e52029ff27dca1ea34343 /ui/app
parentf679b58fcd116b5b4c3896e6aa9a16c54c0ab1ee (diff)
parent835d4fbb139185a0026a24bb2f25ae55d7ee2baf (diff)
downloadtangerine-wallet-browser-232600d928724b7ea8f92bdca55ee0f5001a5df7.tar.gz
tangerine-wallet-browser-232600d928724b7ea8f92bdca55ee0f5001a5df7.tar.zst
tangerine-wallet-browser-232600d928724b7ea8f92bdca55ee0f5001a5df7.zip
Merge remote-tracking branch 'origin/develop' into Version-v7.0.0
* origin/develop: Update mobile sync (#6967)
Diffstat (limited to 'ui/app')
-rw-r--r--ui/app/pages/mobile-sync/index.js11
1 files changed, 8 insertions, 3 deletions
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)
}
}