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

setTimeout on websocket close handler

Open mattnibs opened this issue 9 years ago • 0 comments

I'm sure this reasoning could apply to other areas in the code base... but it seems if you want websocket to mimic its real life counterpart, all the functionaliy inside websocket.close() should happen behind a setTimeout call.

Currently I'm writing a test verify that the readyState on the websocket is set to CLOSING immediately after I invoke websocket.close. Because websocket.close occurs synchronously it's impossible to test for this. Thoughts?

mattnibs avatar Feb 29 '16 22:02 mattnibs