public void SendOpMsg(object temp) { string msg = JsonConvert.SerializeObject(temp, Formatting.Indented); #if WINDOWS_UWP var task = Task.Run(async() => { writer.WriteString(msg); await writer.StoreAsync(); }); task.Wait(); #else Debug.Log(msg); ws.SendAsync(msg, OnSendComplete); #endif }