There doesn't seem to be a way to close a WebSocket connection. My use-case is that I have a React component that connects to a URL that I don't know until runtime, so I create the connection in my component. I need to be able to close the connection when my component is unmounted.