IEnumerator StartConnect(System.Action callback = null) { socket = new GameSocket(host, port); socket.onReceiveMessage = this.OnReceiveMsg; socket.onDisconnect = this.OnDisconnected; socket.onConnected = this.OnConnected; socket.Connect(); while (!socket.Connected) { yield return(null); } if (callback != null) { callback(); } StartCoroutine(socket.Dispatcher()); }