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

Expose WebSocket for network access #696

Merged
merged 4 commits into from
Mar 3, 2022

Conversation

FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Feb 23, 2022

Expose WebSocket for network access endowment.

Description

  • ADDED:
    • Expose WebSocket for network access endowment.

Checklist

  • Tests are included if applicable
  • Any added code is fully documented

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

So, since we're adding WebAssembly as a default endowment, we should get rid of the endowment permission for it. We should still add XMLHttpRequest to the network access endowment.

Edit: While we're here, it might be worth looking into whether we can add WebSocket as one of the available APIs.

@FrederikBolding FrederikBolding changed the title Add WASM endowment and expose XMLHttpRequest for network access Expose XMLHttpRequest for network access Mar 1, 2022
@FrederikBolding
Copy link
Member Author

So, since we're adding WebAssembly as a default endowment, we should get rid of the endowment permission for it. We should still add XMLHttpRequest to the network access endowment.

Done!

Edit: While we're here, it might be worth looking into whether we can add WebSocket as one of the available APIs.

The only issue with adding WebSocket is that it's not available for Node.js. So I'm guessing we'll need some sort of polyfill or otherwise create a shared interface 🤔

@FrederikBolding
Copy link
Member Author

According to this implementation https://github.com/heineiuo/isomorphic-ws you can use the browser WebSocket and ws interchangeably in some cases, but not all.

Some major differences:

  • no Server implementation in browsers
  • no support for the constructor options argument in browsers

I guess we could strip out some of these things in the same way we do for WebAssembly? 🤔

@FrederikBolding FrederikBolding changed the title Expose XMLHttpRequest for network access Expose XMLHttpRequest and WebSocket for network access Mar 1, 2022
@FrederikBolding FrederikBolding marked this pull request as ready for review March 2, 2022 10:36
@FrederikBolding FrederikBolding requested a review from a team as a code owner March 2, 2022 10:36
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

Wait, scratch that. XMLHttpRequest doesn't exist in Node, and we should probably remove it.

@FrederikBolding FrederikBolding changed the title Expose XMLHttpRequest and WebSocket for network access Expose WebSocket for network access Mar 3, 2022
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM!

@FrederikBolding FrederikBolding merged commit e8598c3 into main Mar 3, 2022
@FrederikBolding FrederikBolding deleted the fb/wasm-and-xmlhttprequest branch March 3, 2022 08:03
soralit pushed a commit to KeystoneHQ/controllers that referenced this pull request Mar 14, 2022
* Expose XMLHttpRequest for network access endowment

* Add WebSocket

* Fix linting

* Remove XmlHttpRequest since its not available in Node.js
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* Expose XMLHttpRequest for network access endowment

* Add WebSocket

* Fix linting

* Remove XmlHttpRequest since its not available in Node.js
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* Expose XMLHttpRequest for network access endowment

* Add WebSocket

* Fix linting

* Remove XmlHttpRequest since its not available in Node.js
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

Successfully merging this pull request may close these issues.

2 participants