Example #1
0
        private static void Client2_OnLogined(object sender, string msg)
        {
            var client2 = sender as MessageClient;

            client2.SubscribeAsync("all");

            FunHelper.WhileAsync(() =>
            {
                client2.SendPrivateMsg(uid1, "你好姗姗,我是思思");
            }, 1000, true);
        }
Example #2
0
 private static void Client3_OnLogined(object sender, string msg)
 {
     Task.Factory.StartNew(() =>
     {
         var client3 = sender as MessageClient;
         client3.SubscribeAsync("all");
         FunHelper.WhileAsync(() =>
         {
             client3.PublishAsync("all", msg);
         }, 3000);
     });
 }
Example #3
0
        private static void Client_OnConnected1(WSClient client)
        {
            ConsoleHelper.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " 当前客户端已连上");

            FunHelper.WhileAsync(() =>
            {
                //client.SendAsync(longStr);
                client.SendAsync(new GFF.WS.Model.WSMessage()
                {
                    ID      = Guid.NewGuid().ToString("N"),
                    Content = longStr,
                    Sender  = "CS",
                    time    = DateTime.Now.Ticks.ToString()
                });
            }, 1000);
        }