-
Notifications
You must be signed in to change notification settings - Fork 283
[WIP] (#1851) Send offline messages through web relay if configured #1824
base: master
Are you sure you want to change the base?
Conversation
Excellent! @hoffmabc will you be making addition commits for this PR to add the offline message listener via the relay? |
@hoffmabc bump |
@hoffmabc if we're pursuing this, I'd like to see the following improvements after doing a quick scan through:
|
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 |
I'm fine with whatever approach you guys want to take. I'll defer to @drwasho on this one. |
074d992
to
8c4e021
Compare
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. |
gofmt gofmt Update deps Updates return error
Keep connections open and refactor sending outbound messages to all connections.
Fix peer ID Fix peer ID
bf080a2
to
a805f45
Compare
5a46873
to
806a563
Compare
conn, err := wrm.connectToServer(relay, wrm.peerID) | ||
if err != nil { | ||
log.Error("Could not connect to: %s", relay) | ||
} |
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.
@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.
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.
good catch
8b3d2b7
to
5a46873
Compare
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.
Fix nil check
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:
Offline messages will now also be sent through the configured web relay using websockets with this PR.
Solves: #1851
Testing:
Parent issue: #1851