mock-socket
mock-socket copied to clipboard
The onerror/onclose/... event handlers of websocket does not mock correctly
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.
For me those callbacks are not triggered when calling mockServer.stop()
.
Edit: They are triggered with mockServer.close()
. 🎉