public Form1() { InitializeComponent(); var coreConfig = new AVClient.Configuration { ApplicationId = appId, ApplicationKey = appId, }; AVClient.Initialize(coreConfig); AVClient.HttpLog(AppendLogs); var realtimeConfig = new AVRealtime.Configuration() { ApplicationId = appId, ApplicationKey = appkey, OfflineMessageStrategy = AVRealtime.OfflineMessageStrategy.UnreadAck, }; Websockets.Net.WebsocketConnection.Link(); AVRealtime.WebSocketLog(AppendLogs); realtime = new AVRealtime(realtimeConfig); lbx_messages.DisplayMember = "Content"; lbx_messages.ValueMember = "Id"; lbx_messages.DataSource = data; realtime.OnOfflineMessageReceived += Realtime_OnOfflineMessageReceived; }
public Task TestRequestRealtimeSignature() { AVClient.HttpLog(Console.WriteLine); var u = Utils.RandomUsername(); var p = Utils.RandomString(10); AVUser user = new AVUser() { Username = u, Password = p }; return(user.SignUpAsync().ContinueWith(t => { Assert.False(t.IsFaulted); Assert.False(t.IsCanceled); return AVCloud.RequestRealtimeSignatureAsync(); }).Unwrap().ContinueWith((Task <AVCloud.RealtimeSignature> t) => { Assert.IsFalse(t.IsCanceled); Assert.IsFalse(t.IsFaulted); Assert.IsNotEmpty(t.Result.ClientId); Assert.AreNotEqual(t.Result.Timestamp, 0); Assert.IsNotEmpty(t.Result.Signature); Assert.IsNotEmpty(t.Result.Nonce); })); }
static async void Test() { //string appId = "Eohx7L4EMfe4xmairXeT7q1w-gzGzoHsz"; //string appKey = "GSBSGpYH9FsRdCss8TGQed0F"; string appId = "FQr8l8LLvdxIwhMHN77sNluX-9Nh9j0Va"; string appKey = "MJSm46Uu6LjF5eNmqfbuUmt6"; AVRealtime.WebSocketLog(Console.WriteLine); AVClient.HttpLog(Console.WriteLine); AVClient.Initialize(appId, appKey); Websockets.Net.WebsocketConnection.Link(); var realtime = new AVRealtime(new AVRealtime.Configuration { ApplicationId = appId, ApplicationKey = appKey }); AVLiveQuery.Channel = realtime; var query = new AVQuery <AVObject>("GameObject").WhereEqualTo("objectId", "5cedee8e58cf480008de9caa"); //var query = new AVQuery<AVObject>("GameObject").WhereExists("objectId"); liveQuery = await query.SubscribeAsync(); liveQuery.OnLiveQueryReceived += OnLiveQueryReceived; Console.WriteLine("done"); }
protected TestBase() { AVClient.HttpLog(Console.WriteLine); AVRealtime.WebSocketLog(Console.WriteLine); AVClient.Initialize(AppId, AppKey); CNRealtime = new AVRealtime(AppId, AppKey); }
public static void ConfigCloud(Cloud cloud) { AVClient.Initialize("JRsk29cDwQNGHaIM2PM0VBWt-9Nh9j0Va", "uerPuKWcaSqHGBYVbPBYcv6V"); AVClient.HttpLog(Console.WriteLine); cloud.UseLog(); cloud.UseHttpsRedirect(); }
public virtual void SetUp() { string appId = "cfpwdlo41ujzbozw8iazd8ascbpoirt2q01c4adsrlntpvxr"; string appkey = "lmar9d608v4qi8rvc53zqir106h0j6nnyms7brs9m082lnl7"; //string appId = "EB23wEzd6WPhGlwjMVgEPxg6-gzGzoHsz"; //string appkey = "6jEGd98CIOUyH6LQrotQSNVb"; Websockets.Net.WebsocketConnection.Link(); var coreConfig = new AVClient.Configuration { ApplicationId = appId, ApplicationKey = appId, }; AVClient.Initialize(coreConfig); AVClient.HttpLog(AppendLogs); var realtimeConfig = new AVRealtime.Configuration() { ApplicationId = appId, ApplicationKey = appkey, RealtimeServer = new Uri("wss://rtm51.leancloud.cn"), OfflineMessageStrategy = AVRealtime.OfflineMessageStrategy.Default }; AVRealtime.WebSocketLog(AppendLogs); realtime = new AVRealtime(realtimeConfig); }
public void SaveObject() { AVClient.HttpLog(Debug.Log); var todo = new AVObject("Todo"); todo["title"] = "XD"; todo.SaveAsync(); }
public void CallLocalEngine() { AVClient.HttpLog(Debug.Log); AVCloud.CallFunctionAsync <string>("hello", null).ContinueWith(t => { Debug.Log(t.Result); }); }
public void initApp() { Websockets.Net.WebsocketConnection.Link(); string appId = ConfigurationManager.AppSettings["appId"]; string appKey = ConfigurationManager.AppSettings["appKey"]; avRealtime = new AVRealtime(appId, appKey); //avRealtime = new AVRealtime("5ptNj5fF9TplwYYNYo34Ujmi-gzGzoHsz", "oxEMyVyz3XmlI8URg87Xp1l5"); AVClient.HttpLog(Console.WriteLine); }
public void SetUp() { AVRealtime.WebSocketLog(Console.WriteLine); AVClient.HttpLog(Console.WriteLine); AVClient.Initialize(AppId, AppKey, Server); Websockets.Net.WebsocketConnection.Link(); var realtime = new AVRealtime(new AVRealtime.Configuration { ApplicationId = AppId, ApplicationKey = AppKey }); AVLiveQuery.Channel = realtime; }
public Task TestDecodeDateTimeTimeZone() { var todo = new AVObject("Todo"); var datetimeStr = "2017-04-02"; AVClient.HttpLog(s => { Debug.WriteLine(s); }); //var testDateTimeObj = todo["testDateTime"] = DateTime.ParseExact(datetimeStr, "yyyy-MM-dd", null, DateTimeStyles.AssumeLocal); var testDateTimeObj = DateTime.Now; todo["testDateTime"] = testDateTimeObj; return(todo.SaveAsync().ContinueWith(t => { var query = new AVQuery <AVObject>("Todo").WhereEqualTo("objectId", todo.ObjectId); return query.FirstAsync(); }).Unwrap().ContinueWith(s => { var afterSavedTestDateTimeObj = s.Result.Get <DateTime>("testDateTime"); Assert.True(afterSavedTestDateTimeObj.Hour.Equals(testDateTimeObj.Hour)); })); }
public NetComponent() { Logger.LogDelegate = (level, log) => { if (level == LogLevel.Debug) { Debug.LogFormat("[DEBUG] {0}", log); } else if (level == LogLevel.Warn) { Debug.LogWarningFormat("[WARN] {0}", log); } else if (level == LogLevel.Error) { Debug.LogErrorFormat("[ERROR] {0}", log); } }; AVClient.HttpLog(Debug.Log); AVClient.Initialize(_appId, _appKey, _tempUrl); WebClient = new Client(_appId, _appKey, Guid.NewGuid().ToString()); }
public void SetUp() { AVClient.HttpLog(Console.WriteLine); AVRealtime.WebSocketLog(Console.WriteLine); }