public static void ClientInit(bool status = false) { Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " 客户端测试"); WSClient client = new WSClient(); if (!status) { client.OnConnected += Client_OnConnected; } else { client.OnConnected += Client_OnConnected1; } client.OnReceived += Client_OnReceived; client.OnReceivedMessage += Client_OnReceivedMessage; client.ConnectAsync(url); }