mock-socket icon indicating copy to clipboard operation
mock-socket copied to clipboard

The onerror/onclose/... event handlers of websocket does not mock correctly

Open hktonylee opened this issue 7 years ago • 1 comments

In a normal DOM object calling this.addEventListener('error', ...) does not affect this.onerror and vice versa. However in this mock library they affect each other and this certainly break the contract of using DOM EventTarget.

Please fix this because many libraries rely on this behaviour to work correctly. Please advice if I can submit a pull request about this breaking changes but make it more compatible with standard DOM web socket.

hktonylee avatar Sep 11 '17 04:09 hktonylee

For me those callbacks are not triggered when calling mockServer.stop().

Edit: They are triggered with mockServer.close(). 🎉

n1ru4l avatar Nov 22 '17 13:11 n1ru4l