Comments (5)
Did you have any specific requirements that led you to use a persistent port for this channel or was it because the docs seem to suggest there's only chrome.runtime.connect
?
The regular sendMessage works in both devtools.html and devtoolsPanel.html:
I'll likely be implementing this part with the the regular sendMessage API, at least for the beginning.
from webext-messenger.
Did you have any specific requirements that led you to use a persistent port for this channel or was it because the docs seem to
Originally I did it because I was copypasta'ing docs.
When using normal messaging, can the background page initiate messages to the devtools? (What would the tab/frame be for the target?) In the "actor" model the devtools would need to send a message to the background page on initialization. At that point, it's like the port creation, but without the benefits of having a port
What are the benefits of having a port? 1) Lower latency? 2) Getting an event when the port connection is closed?
Maybe we start with regular message, and then move everything to ports (including content script) where it's supported?
from webext-messenger.
When using normal messaging, can the background page initiate messages to the devtools?
I think not, but as pointed out in #3 maybe this is never needed.
What are the benefits of having a port? 1) Lower latency? 2) Getting an event when the port connection is closed?
I think that's the idea.
Maybe we start with regular message, and then move everything to ports (including content script) where it's supported?
Yes, CS also supports ports. What concerns me though is that ports have a major inconvenience:
- the message handler can't respond just by returning, it has to send a message back
This means:
- the sender can't just await
runtime.sendMessage
but has to listen to messages and connect them to the original message sent - errors have to be serialized and deserialized manually (or at least handled manually)
For this reason I think I should find out whether the latency is actually lower enough to justify the complexity.
from webext-messenger.
What concerns me though is that ports have a major inconvenience:
In my mind, a potential benefit this library is to put an abstraction around that, so clients can get the benefits of the port, while still being able to do it with a standard async call
from webext-messenger.
As later discovered, the port only appears to have lower latency because the connection has to happen beforehand. Regular messages have the same latency after the first message to a context.
See pixiebrix/pixiebrix-extension#1546 (comment)
from webext-messenger.
Related Issues (20)
- Remove branch protection from repo HOT 1
- Handle repeated injection gracefully HOT 6
- Drop `webextensions-polyfill` to avoid unnecessary abstraction
- Toggle WEBEXT_LOGGING at runtime
- Dispatch retries event and retry-exhaustion event
- Do not retry discarded tabs, return specific error
- Use `browser.runtime.getFrameId()` HOT 1
- Update Parcel
- Track timing HOT 2
- Immediately handle context invalidation, disabling further messaging
- Accept `Promise<Target>`
- Support `allFrames` as target
- Ensure sequence numbers are never reused HOT 2
- Error: Tabs cannot be edited right now (user may be dragging a tab).
- `retry: false` not respected when forwarding
- Add `extractTargetFromSender`
- Unwanted forwarding when targeting `allFrames` HOT 2
- Fail when trace.length > 2 HOT 2
- Meta: update parcel to 2.12+
- Preserve seq number when forwarding
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webext-messenger.