A way to trigger Web Socket onerror
before connection
event
#2364
Unanswered
sfc-gh-jtjhin
asked this question in
Q&A
Replies: 1 comment 6 replies
-
Hi, @sfc-gh-jtjhin. Yes, you can emulate the const api = ws.link('wss://localhost')
export const handlers = [
api.addEventListener('connection', () => {
throw new Error('Connection error')
})
] This will get translated to a connection error, and will trigger both This works because the |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Scope
Improves an existing behavior
Compatibility
Feature description
I'd like to be able to test if the a web socket connection erroring e.g. firewall issue
Similar to https://mswjs.io/docs/recipes/network-errors for REST requests
Beta Was this translation helpful? Give feedback.
All reactions