Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

[WIP] (#1851) Send offline messages through web relay if configured #1824

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

hoffmabc
Copy link
Member

@hoffmabc hoffmabc commented Oct 24, 2019

This does not address the config file migration so for now to test this you need to add this to the bottom of your config file:

"WebRelays": [
        "wss://webchat.ob1.io:8080"
    ]

Offline messages will now also be sent through the configured web relay using websockets with this PR.

Solves: #1851

Testing:

  • Spin up two new nodes with fresh data directories on two different machines
  • If possible block incoming connections to those nodes to simulate mobile (or just use mobile)
  • Start both up
  • Send chat messages or order messages between the nodes and check the logs for OFFLINE_RELAY messages

Parent issue: #1851

@hoffmabc hoffmabc added the feature Feature or enhancement to openbazaar-go label Oct 24, 2019
@hoffmabc hoffmabc requested review from drwasho and cpacia October 24, 2019 20:38
@hoffmabc hoffmabc self-assigned this Oct 24, 2019
@drwasho
Copy link
Member

drwasho commented Oct 24, 2019

Excellent! @hoffmabc will you be making addition commits for this PR to add the offline message listener via the relay?

@drwasho
Copy link
Member

drwasho commented Oct 27, 2019

@hoffmabc bump

@placer14
Copy link
Member

placer14 commented Nov 4, 2019

@hoffmabc if we're pursuing this, I'd like to see the following improvements after doing a quick scan through:

  1. Update the PR description indicating what impact these changes will have. Maybe a use case illustrating their need. And perhaps instructions for setting this up for independent testing/verification. (Something that can later be used for updating our official docs.)
  2. Error handling inside the relay manager.
  3. Unit tests around the relay manager and the new config getter.
  4. Travis passing.

@placer14
Copy link
Member

placer14 commented Nov 5, 2019

Thinking about this further, I like that this was produced as a separate manager from a pattern perspective. However, I think that our message sending is getting spread across a few different parts of our app and this implementation might be improved if we take a second to refactor our message sending behavior to support sending a message via multiple transports (a message mux of sorts).

I don't think we're in a hurry to deliver this, perhaps we can reconsider our approach before digging into unit tests and error handling as mentioned before? /cc @drwasho @hoffmabc

@hoffmabc
Copy link
Member Author

hoffmabc commented Nov 6, 2019

I'm fine with whatever approach you guys want to take. I'll defer to @drwasho on this one.

@hoffmabc hoffmabc changed the base branch from master to ethereum-master November 7, 2019 15:04
@hoffmabc hoffmabc changed the base branch from ethereum-master to master November 7, 2019 15:44
@coveralls
Copy link

coveralls commented Nov 7, 2019

Coverage Status

Coverage decreased (-0.3%) to 38.148% when pulling 8b3d2b7 on brian.use-relay into b80611d on master.

@hoffmabc hoffmabc changed the title [WIP] Send offline messages through web relay if configured (1851) Send offline messages through web relay if configured Nov 9, 2019
@hoffmabc
Copy link
Member Author

hoffmabc commented Nov 9, 2019

Thinking about this further, I like that this was produced as a separate manager from a pattern perspective. However, I think that our message sending is getting spread across a few different parts of our app and this implementation might be improved if we take a second to refactor our message sending behavior to support sending a message via multiple transports (a message mux of sorts).

I don't think we're in a hurry to deliver this, perhaps we can reconsider our approach before digging into unit tests and error handling as mentioned before? /cc @drwasho @hoffmabc

Perhaps this refactor to mux model could be a larger, broader refactor later on? I think that pursuing that in this PR would probably expand the scope and prevent rollout for quite a while.

@hoffmabc hoffmabc changed the title (1851) Send offline messages through web relay if configured (#1851) Send offline messages through web relay if configured Nov 9, 2019
conn, err := wrm.connectToServer(relay, wrm.peerID)
if err != nil {
log.Error("Could not connect to: %s", relay)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoffmabc wrm.connections = append(conns, conn) should be in an else bock of if err != nil { otherwise in the case of a connection error, your are adding a nil connection to the list.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@placer14 placer14 changed the title (#1851) Send offline messages through web relay if configured [WIP] (#1851) Send offline messages through web relay if configured Dec 9, 2019
Copy link
Member

@cpacia cpacia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix nil check

@OpenBazaar OpenBazaar deleted a comment from cpacia Dec 11, 2019
@OpenBazaar OpenBazaar deleted a comment from cpacia Dec 11, 2019
@drwasho drwasho added the 🚧 in progress Issue or PR is currently being worked on and not in final form. label Dec 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discussion feature Feature or enhancement to openbazaar-go 🚧 in progress Issue or PR is currently being worked on and not in final form. invalid
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants