Good day, everyone!
I have taken on a new role in my company that involves me maintaining our browser extension which is based on MV2. I have a few concerns about the migration to MV3, and I was hoping to get some guidance.
For some background, we sell a bluetooth LE device that integrates with our password management software. Basically, as long as the device is in range, you can have access to your passwords.
The implication of this is that our desktop app needs to tell our Chrome extension "hey, the device is still in range!" regularly through a WebSocket. In fact, the extension's only way of getting sensitive data is through that WebSocket. I understand that WebSockets are still allowed in MV3, but I am concerned that the ephemeral nature of service workers will make this process impractical if not infeasible.
Sure, it's not a problem if the user doesn't need their credentials for a while, but what Chrome API could be called to 'wake up' the service worker after it dies? I've seen a good bit of workarounds in this forum talking about doing some arbitrary Chrome API call every 4.9 minutes to keep it alive or keeping a tab open specifically for the extension to run, but in my opinion these are hacky and counterintuitive.
Even if there was an MV3-compliant way to go about this, the user would no longer be able to see battery % or do basically anything at all in the extension if the service worker is not active.
I'll admit that I may not be getting the full picture here, but it seems that disallowing persistent background scripts in MV3 more or less breaks our entire Chrome platform. From what I have read around here, there are plenty of other people that have similar concerns and I hope that we will be able to find a solution that works for us all.
Also, I would like to politely note that the documentation for MV3 can be a little lacking--it's unclear how Chrome handles the lifecycle of Service Workers (i.e., conditions and timelines for becoming active/inactive). There's also not a lot of great guidance for maintaining state, other than the "in-memory storage" thing that doesn't seem to be a good replacement due to storage limits. All in all, I felt that a few questions that MV3 raised for me were far better answered in threads here than they were in the official docs.
I look forward to hearing y'alls thoughts on this!