This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Use Websocket to get new transactions - Closes #843 #889
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ginacontrino
force-pushed
the
843-websocket
branch
from
October 19, 2017 15:40
8b445b0
to
a9fc68e
Compare
ginacontrino
force-pushed
the
843-websocket
branch
2 times, most recently
from
October 20, 2017 13:43
8645d8d
to
94e18e6
Compare
ginacontrino
force-pushed
the
843-websocket
branch
2 times, most recently
from
October 26, 2017 16:13
31284a7
to
9bd856b
Compare
ginacontrino
force-pushed
the
843-websocket
branch
2 times, most recently
from
November 2, 2017 09:59
01ecc6f
to
15fbafa
Compare
reyraa
suggested changes
Nov 2, 2017
src/store/middlewares/account.js
Outdated
const state = store.getState(); | ||
const { peers, account } = state; | ||
|
||
if (action.data.windowIsFocused && hasRecentTransactions(state)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of brevity, pass transactions to this function. the you can do
const { peers, account, transactions } = store.getState();
src/store/middlewares/socket.js
Outdated
const ssl = store.getState().peers.data.options.ssl; | ||
const protocol = ssl ? 'https' : 'http'; | ||
|
||
connection = io.connect(`${protocol}://${store.getState().peers.data.currentPeer}:${store.getState().peers.data.port}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this to a separated function
const socketSetup = (store) => { | ||
let windowIsFocused = true; | ||
const { ipc } = window; | ||
if (ipc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move this to a separated function
ginacontrino
force-pushed
the
843-websocket
branch
from
November 3, 2017 08:31
4bf581b
to
0bdcfb3
Compare
reyraa
approved these changes
Nov 3, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @ginacontrino Good job!
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem?
We were making a request to the server every 10 seconds to update the account/transactions
#843
What did you do?
Removing the metronome to instead use the socket. This way we want to only update the account/transactions when there was a relevant block added.