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

Add messaging APIs and their infra #1913

Merged
merged 24 commits into from
Oct 10, 2024
Merged

Conversation

autonome
Copy link
Collaborator

@autonome autonome commented Oct 7, 2024

Everything in this area is grouped in the Communications section of the HTML spec. I added a group called Messaging instead of going the spec route, since it aligns more with how developers refer to these features.

I joined MessageChannel and MessagePort into Channel Messaging, aligning with how the spec, MDN and Caniuse do it.

MessageEvent is implemented in numerous places, but doesn't seem like a standalone feature... but messageerror was already done, so I followed that precedent here, adding the various implementation keys as well.

A couple of notes on postMessage:

  • Name: Caniuse calls it Cross-document messaging - which is how the spec describes it too. I dug around and few references by developers to Cross-document messaging, but a zillion to postMessage, so I'm erring on the side of usage-in-the-wild. Sometimes tutorials just called it Web Messaging also, but they pre-dated all the newer messaging stuff.
  • Composition: I pulled in the implementations and put them in a feature together. There's some trade-off against discoverability of the API in the implementation itself. Really a limitation of the "one key, one home" approach in situations like this.

This whole feature group has this same challenge: Do you put the key in the implementation (eg, putting postMessage in each of Window, ServiceWorker, etc) or put the implementation keys in the feature. Might be worth a deeper discussion with the group. I'll bring this up at the meeting this week.

Features previously done in this area:

  • BroadcastChannel
  • messageerror

Features added here:

  • Channel Messaging - includes MessageChannel and MessagePort
  • postMessage
  • EventSource
  • MessageEvent

Group added here:

  • Messaging

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Oct 7, 2024
@autonome autonome marked this pull request as ready for review October 8, 2024 10:22
Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very close now. Two small fixes to make and refreshing the dist, then we can land this. Thank you!

@ddbeck ddbeck enabled auto-merge (squash) October 10, 2024 12:24
@ddbeck ddbeck merged commit 147a0f5 into web-platform-dx:main Oct 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants