Running apollo client example in nodejs environment gives "ReferenceError: CloseEvent is not defined" error #255
Answered
by
enisdenjo
sal-limones
asked this question in
Q&A
-
I'm trying to run both apollo server and client with graphql-ws subscriptions and can't figure out where to get the CloseEvent type for the nodejs environment. |
Beta Was this translation helpful? Give feedback.
Answered by
enisdenjo
Oct 29, 2021
Replies: 1 comment 1 reply
-
function isLikeCloseEvent(val) {
return 'code' in Object(val) && 'reason' in Object(val);
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sal-limones
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CloseEvent
does not exist in thews
library, it is exclusively a browser global class. You can, however, check if a value is like a close event. Two properties can distinguish a close event, here's the check: