Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

[TS] Change websocket library in Node #2989

Merged
merged 4 commits into from
Sep 21, 2018
Merged

Conversation

BrennanConroy
Copy link
Member

@BrennanConroy BrennanConroy commented Sep 20, 2018

#2973
Also, #2986

Inverted a couple instanceof ArrayBuffer checks because the ArrayBuffer returned from ws isn't an ArrayBuffer or something super odd, so checking for string instead and assuming buffer otherwise works.

See nodejs/node#20978 for some context maybe? @anurse maybe you'll understand it better.

@BrennanConroy
Copy link
Member Author

BrennanConroy commented Sep 20, 2018

We'll need to do the needful after this is merged. Or wait, it's semi-automatic now?

(val instanceof ArrayBuffer ||

// Sometimes we get an ArrayBuffer that comes from a polyfill
(val.constructor && val.constructor.name === "ArrayBuffer"));
Copy link
Member

Choose a reason for hiding this comment

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

Why is the formatting so bad?

@analogrelay
Copy link
Contributor

This is different runtime dependency, so it still needs @Eilon to approve

export function isArrayBuffer(val: any): val is ArrayBuffer {
return val && typeof ArrayBuffer !== "undefined" &&
(val instanceof ArrayBuffer ||
// Sometimes we get an ArrayBuffer that comes from a polyfill
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I wrote this comment when I was randomly speculating :). Just say something like "Sometimes we get an ArrayBuffer that doesn't satisfy instanceof 🤷‍♂️ "

"nan": "^2.3.3",
"typedarray-to-buffer": "^3.1.2",
"yaeti": "^0.0.6"
"async-limiter": "~1.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Fewer extra deps. Nice :)

@@ -32,7 +32,7 @@
"karma-summary-reporter": "^1.5.0",
"ts-node": "^4.1.0",
"typescript": "^3.0.1",
"websocket": " ^1.0.26"
"ws": " ^6.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

So I need to get approval for this one?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we are swapping in a pure-JavaScript websocket library instead of the previous WebSocket library we were using which had a native component.

Copy link
Member

Choose a reason for hiding this comment

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

Approved.

@BrennanConroy
Copy link
Member Author

BrennanConroy commented Sep 20, 2018 via email

@Eilon
Copy link
Member

Eilon commented Sep 20, 2018

@BrennanConroy removals don't matter.

@BrennanConroy BrennanConroy merged commit ef3d3b1 into release/2.2 Sep 21, 2018
@BrennanConroy BrennanConroy deleted the brecon/newws branch September 21, 2018 15:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants