6.3 Closing WebSocket connection
Compliant with section 7 of IETF RFC 6455 [1] a WebSocket connection shall be closed by sending a Connection Close Frame (opcode x8). Both, client and server may initiate a closing handshake of an existing WebSocket connection at any time.
WebSocket connections should be kept open for as long as possible considering any given constraints due to communication policies and power saving requirements. Unless communication policies enforce the closing of network access, it is left to implementation to decide when exactly the closing of a WebSocket shall be triggered.