I always thought that web socket guarantees delivery of data as it is built on top of TCP which is reliable. I was reading the Java web socket API documentation on this link
https://docs.oracle.com/javaee/7/api/javax/websocket/RemoteEndpoint.html
It says that
There is no guarantee of the successful delivery of a web socket message to the peer, but if the action of sending a message causes an error known to the container, the API throws it.
Shouldn't TCP gurantee the message delivery?