-
Notifications
You must be signed in to change notification settings - Fork 54
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
[FEATURE] Chrome Extension Manifest V3 Support #247
Comments
Can we use twilio conversation sdk and voice sdk both at the same time ? We have our extension that is using both at the same time. Since the service worker should create offscreen documents to run the SDK and only 1 offscreen document can be open at one time. Is it possible? |
You should be able to run both in one offscreen document if you want to. |
How do we register events such as call accept, disconnect, similarly for conversation and message we have multiple events. Since offscreen document can be closed how can we manage state. |
This repo is for questions regarding Twilio Voice JavaScript SDK. For conversations related, please reach out to your account manager or submit a ticket using your Twilio account. You can still register events in the voice sdk when running offscreen documents. The lifecycle of the document is determined depending on the reasons as mentioned here https://developer.chrome.com/docs/extensions/reference/api/offscreen. For example, when a call comes in, your service worker creates the offscreen document and loads the voice js sdk. During a call, the offscreen document remains open because of the "reasons" you provided. See example here https://github.com/twilio/twilio-voice.js/blob/feature/chrome_ext_mv3_external_signaling/extensions/chrome/app/worker/worker.js#L85 |
Thanks for your responses. Last question we handle inbound call workflow using twilio taskrouter. So when someone loggedin we setup worker for it. Then inbound call received using reservation events. How we can setup these events. |
No worries @GhazanfarKhan . Which events are you referring to? Can you provide a link to the API docs just to make sure we're referring to the same thing? |
offscreen document shouldn't be closed as long as user is waiting for call is that correct? |
It seems the worker reservation events you provided are not related to voice js sdk. Please reach out to support and they should be able to route you properly.
Per chrome's mv3 documentation, if you're only waiting, the document will close. You need to be actively doing the "reasons" you provided. For voice js sdk, you will be doing 'AUDIO_PLAYBACK', 'USER_MEDIA', 'WEB_RTC' which all happens during a call. I suggest you initiate the call soon after you create the offscreen document. |
In your mv3 example if browser page is refreshed do the call remains in offscreen page or it will be disconnected and cleared? because in mv2 we setup call in background.js and call remains connected when the page refresh or not. |
Yes, offscreen page will remain if the browser page is refreshed in mv3. Same behavior as mv2. |
We added better support for chrome extensions in v2.11.0. See https://github.com/twilio/twilio-voice.js/blob/master/CHANGELOG.md#2110-may-2-2024 |
In manifest V2, extensions have the ability to run the Twilio Voice JS SDK in the background. But with the introduction of manifest V3 (MV3), running the Twilio Voice JS SDK in the background using service workers does not work out of the box due to certain limitations which include DOM access and the ability to keep the service worker alive.
In order to make outgoing calls and listen/receive incoming calls through the SDK, the service worker should be connected to a WebSocket server and should send/receive messages periodically to keep it alive. Also, the service worker should create offscreen documents to run the SDK. Check our example to see how this works.
Looking ahead, we are working on a solution that allows for running the SDK in MV3 without having to setup a separate WebSocket server. Please watch this issue for future updates.
The text was updated successfully, but these errors were encountered: