public async Task TearDown() { await m1.Close(); await m2.Close(); Utils.TearDown(); }
public async Task TearDown() { await c1.Close(); await c2.Close(); await lean.Close(); Utils.TearDown(); }
public async Task OpenAndClose() { LCIMClient c1 = new LCIMClient("c1"); LCIMClient c2 = new LCIMClient("c2"); await c1.Open(); await c2.Open(); await c1.Close(); await c2.Close(); }
public async Task OpenAndCloseByLCUser() { LCUser user = await LCUser.Login(USERNAME1, PASSWORD1); LCIMClient client = new LCIMClient(user); await client.Open(); LCUser game = await LCUser.Login(USERNAME2, PASSWORD2); LCIMClient client2 = new LCIMClient(game); await client2.Open(); await client.Close(); await client2.Close(); }
static void Main(string[] args) { WriteLine("Hello World!"); SingleThreadSynchronizationContext.Run(async() => { LCLogger.LogDelegate += Print; LCApplication.Initialize("ikGGdRE2YcVOemAaRbgp1xGJ-gzGzoHsz", "NUKmuRbdAhg1vrb2wexYo1jo", "https://ikggdre2.lc-cn-n1-shared.com"); LCIMClient client = new LCIMClient("lean") { OnPaused = () => { WriteLine("~~~~~~~~~~~~~~~ disconnected"); }, OnResume = () => { WriteLine("~~~~~~~~~~~~~~~ reconnected"); } }; await client.Open(); int count = 0; while (count < 2) { WriteLine($"pause : {count}"); await Task.Delay(5 * 1000); LCRealtime.Pause(); await Task.Delay(5 * 1000); LCRealtime.Resume(); await Task.Delay(5 * 1000); count++; } try { await client.Close(); // Done } catch (Exception e) { WriteLine($"xxxxxxxxxxxx {e.Message}"); } }); }
public async Task CreateChatRoom() { string clientId = Guid.NewGuid().ToString(); LCIMClient client = new LCIMClient(clientId); await client.Open(); client.OnInvited = (conv, initBy) => { WriteLine($"on invited: {initBy}"); }; string name = Guid.NewGuid().ToString(); LCIMConversation conversation = await client.CreateChatRoom(name); string visitorId = Guid.NewGuid().ToString(); LCIMClient visitor = new LCIMClient(visitorId); await visitor.Open(); LCIMChatRoom chatRoom = await visitor.GetConversation(conversation.Id) as LCIMChatRoom; await chatRoom.Join(); LCIMTextMessage textMessage = new LCIMTextMessage("hello, world"); await conversation.Send(textMessage); int count = await chatRoom.GetMembersCount(); ReadOnlyCollection <string> onlineMembers = await chatRoom.GetOnlineMembers(); Assert.GreaterOrEqual(onlineMembers.Count, 1); foreach (string memberId in onlineMembers) { WriteLine($"{memberId} online"); } await client.Close(); await visitor.Close(); }
public async Task TearDown() { await client.Close(); Utils.TearDown(); }