** Sent on a `WebSocket` message event.@Jsclass MsgEvent {** Set in a text message. Str? txt** Set in a binary message. Buf? bufinternalnew make(|This|in){ in(this)} @NoDocoverride Str toStr(){ txt == null ? "Binary - $buf" : "Text - $txt"}}** Sent on a `WebSocket` close event.@Jsconstclass CloseEvent {** Returns 'true' if the connection was closed cleanly.const Bool wasClean** The WebSocket connection close code provided by the server.** Returns 'null' if the connection was not closed cleanly.const Int? code** The WebSocket connection close reason provided by the server.** Returns 'null' if the connection was not closed cleanly.const Str? reasoninternalnew make(|This|in){ in(this)}internal Void writeFrame(WebSocket webSocket){ webSock := (WebSocketFan) webSocket webSock.readyState = ReadyState.closing frame := Frame.makeCloseFrame(code, reason)try webSock.writeFrame(frame)catch{/* meh */}} @NoDocoverride Str toStr(){(wasClean ? "Clean" : "Unclean") + " close - ${code}: ${reason}"}}