IEnumerator WebSocketCoroutine() { string uri = addressInputField.text + "/" + channelInputField.text + "?name=" + nameInputField.text; statusView.NotConnected(); webSocket = new WebSocket(new Uri(uri)); statusView.Connect(); yield return(StartCoroutine(webSocket.Connect())); statusView.Connected(); while (true) { string reply = webSocket.RecvString(); if (reply != null) { textAreaView.RecvString(reply); } if (webSocket.error != null) { textAreaView.RecvString(reply); break; } yield return(new WaitForSeconds(1f)); } }