OpenBazaar / openbazaar-go

OpenBazaar 2.0 Server Daemon in Go
MIT License
994 stars 284 forks source link

Evaluate integration of the web relay #1851

Open drwasho opened 4 years ago

drwasho commented 4 years ago

Overview

Some time ago we put together https://github.com/OpenBazaar/webrelay, which is a server designed to:

  1. Publish offline messages on behalf of other nodes, specifically light clients on web and mobile
  2. Forward any offline messages published to a node over sockets

This is not to be confused with the IPFS relay that facilitates two online nodes forming a connection for direct interactions. The purpose of the web relay is to make publishing offline messages more reliable, and the detection of offline messages more immediate.

This infrastructure is presently used by Zokos to great effect (kudos @rodkeys). Presently, we've started experimenting how this would work in Haven, and since things are getting more serious, we should capture the work in this issue.

Hypothesis

Our expected utility for this work:

  1. More reliable publishing of offline messages (i.e. fewer missing order messages, faster offline message delivery)
  2. Near-instant detection of received offline messages addressed to the node (e.g. chat, order messages)

Phase 1: Feasibility study

We want to evaluate whether our hypothesis :

The manner of this implementation will suit quick testing and not production-level code. If our testing demonstates an improvement in offline message publishing and delivery, then we'll move onto phase 2.

Phase 2: Production integration

After looking at the code we prepared in the branch, we will:

A parallel discussion needs to happen with the infrastructure team, who will be responsible for maintaining the web relay.

Other considerations

Requirements discussed in planning

Client

Server

drwasho commented 4 years ago

Update:

  1. We've done some testing of PR #1824 and it looks like the relay code is working well on desktop and mobile
  2. As a bonus, Brian refactored the code so that we send the relay message first before going through the usual stack (direct, DHT, pubsub etc)
  3. Brian also fixed an issue where the relay wasn't publishing the offline messages it received to the network... so now it is
  4. @hoffmabc is going to add some logging to track when the relay message has been handed over to the server + when an offline message has been successfully published to the network

(3) is really important since while the relay code will make our offline messaging system more robust generally speaking, it might resolve the issue where offline chat and order messages being published to the network are being interrupted when the user hard closes the app.

Testing

placer14 commented 4 years ago

I think this POC could be merged for general use with the following improvements (for considering during our planning call):

drwasho commented 4 years ago

@hoffmabc is going to add some logging to track when the relay message has been handed over to the server + when an offline message has been successfully published to the network

@hoffmabc we got distracted with a bunch of work obviously, but this would still be helpful to put some data behind the theory.

placer14 commented 4 years ago

I've updated the description with the requirements as discussed in our meeting today (with a few amendments). Please ACK this comment or respond with recommended changes once you've had a chance to review.