Closed benlesh closed 10 months ago
I'm confused by these examples, why would you want to wait for open before listening for message on a WebSocket? You can just listen for message immediately, it'll never be dispatched until open happens.
The example also doesn't actually close the socket, it just closes the listener for the message events and then you're waiting for the GC to run and actually close the socket?
I think I'm okay with what we've landed on.
One thing that is true about Observable is it's possible for an observable to cancel an observable.
It's worth proposing that at no extra cost, you can get any event fired to cancel if you have observable in your eco system.
Consider the following:
This could just as easily be:
Or even this:
It's also arguable that
AbortSignal
itself could be "subscribable" given that it only has one event.