iOS the event onClose WebSocket does not work correctly

There is a WebSocket Server JavaEE Tomcat 9.

There are two clients: iOS and Android.

As is the case for Android (Chrome): The client connects to the socket, the onOpen event is triggered, to new messages from the server, onMessage. When the tab is closed, the onClose message is correctly triggered.

As is the case with iOS (Chrome, Safari): The client connects to the socket, the onOpen event is triggered, on the messages from the server - onMessage. And then fun begins. If I close the browser tab, the onClose event will not be (although logically, it should be). Further. I'm creating a new tab in the browser. I enter the first character of the url of the address and I immediately observe onClose (Close event 1003) which follows in onError for something already null. Well, "reconnect" to the socket.

Question. How to repair this?

iOS the event onClose WebSocket does not work correctly
 
 
Q