HomePhabricator
Diffusion Comm 21231f38fb9e

[web] Proxy tunnelbroker messages to the active tab

Description

[web] Proxy tunnelbroker messages to the active tab

Summary:
ENG-6670 : Allow non-primary tabs to send tunnelbroker messages

After previous diff, only one tab at a time can have a tunnelbroker connection. While that isn't a problem if user is just switching between tabs, user can have multiple tabs open at the same time. This means they can interact with both of them, but only one will be able to do tunnelbroker-related operations. Because of this we need to introduce a way for the tabs without the tunnelbroker connection to send the messages to the tab with the connection. This tab will then send the messages to the tunnelbroker. It also needs to notify the other tabs when the message upload completed.

Tab interaction can be implemented using the BroadcastChannelAPI. Each tab connects to a broadcast (differentiated by name) and is able to send and listen to messages.

We don't need to do that for message handling (only message sending) because it's the whole point of this stack -> that only one tab at a time will handle all tunnelbroker messages.

Depends on D11118

Test Plan:

  • Connect to the tunnelbroker from webapp with multiple tabs and a phone.
  • Send a tunnelbroker message to the phone, from a tab with the tunnelbroker connection, and check if it's received
  • Send a tunnelbroker message from a tab without a tunnelbroker connection
  • Switch which tab has the tunnelbroker connection, and which one just send them to the other tab
  • Repeat tests

Reviewers: kamil, inka, bartek

Reviewed By: kamil

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D11123

Details

Provenance
Michal Gniadek <michal.gniadek@swmansion.com>Authored on Feb 19 2024, 7:05 AM
Reviewer
kamil
Differential Revision
D11123: [web] Proxy tunnelbroker messages to the active tab
Parents
rCOMMaff06cc4ecab: [web] Only open tunnelbroker on the active tab
Branches
Unknown
Tags
Unknown