Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SignalR running in Chrome/Edge Manifest v3 Extensions (ServiceWorker) #4647

Open
joeldart opened this issue Sep 30, 2022 · 0 comments
Open

Comments

@joeldart
Copy link

Any functional impact

Chrome and Windows have moved the exectuion context for windowless extensions from a background page with full DOM APIs to a ServiceWorker. This causes a number of obstacles. Within the SW context, you do not have

  • window
  • several APIs jQuery expects
  • xhr

Additionally, the lifetime of a ServiceWorker has a max length of 5 minutes, even when actively connected. At this point, the entire program is terminated. Not ideal certainly for a persisitent server push connection, but still more reliable within various networks than Firebase push.

So there are two concerns here.

  1. Updates required to the JavaScript library to support the use case
  2. Operational concerns on the server side given the presumed increase of orphaned connections. What are the implications in our situation, going from per user creating a new connection_id per hour vs a new connection_id every 5 minutes.

Note, we aren't using any Scaleout backing planes (we use sticky sessions similar to the suggestions in core) but would have 700k+ concurrent connections we're servicing, so I'm fully interested in any feedback

Expected behavior

(Note, expected is a stretch here). When running SignalR in a manifest v3 extension compared to a manifest v2 extension, there is a slight performance decrease, slight increased cpu usage on the server side, and increased battery usage on the client machine with the increase in needed connections (as opposed to sticking with the already created conncetion).

Actual behavior

SignalR does not work

Steps to reproduce

  1. create an mv3 extension with background set to service worker (using https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/examples/hello-world as the base)
  2. in background.js call
importScripts("path-to-signalr/signalr.js"); 
  1. Go to chrome://extensions and load unpacked extension
  2. see errors Service worker registration failed. Status code: 15 and Uncaught ReferenceError: window is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant