A way to trigger Web Socket onerror before connection event
#2364
Replies: 2 comments 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.
-
|
Re-created bug report #2446 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
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