Use this method to close the websocket connection cleanly This sends a close frame and waits for acknowlegement before closing the connection
define WebSocket callbacks
[Validate]