예제 #1
0
        private async Task <string> GetSocketKey(string sUrl)
        {
            WebSocketClient wsc = new WebSocketClient();
            await wsc.Connect(sUrl);

            var oMessage = wsc.Messages.FirstOrDefault(x => x.Body.Contains("\"key\":"));

            if (oMessage != null)
            {
                oConsole.AddLine("Autenticacion exitosa guacho!", ConsoleColor.Green);
                return(oMessage.Body.Split(',').FirstOrDefault(x => x.Contains("\"key\"")).Split(':')[1].Trim('"'));
            }
            else
            {
                oConsole.AddLine($"Hubo un error tratando de conectarse al WebSocket {sUrl}, chequea que onda", ConsoleColor.Red, true);
                return("");
            }
        }
예제 #2
0
        private async Task <string> GetSocketKey(string sUrl)
        {
            WebSocketClient wsc = new WebSocketClient();
            await wsc.Connect(sUrl);

            var oMessage = wsc.Messages.FirstOrDefault(x => x.Body.Contains("\"key\":"));

            if (oMessage != null)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Autenticacion exitosa guacho!");
                Console.ResetColor();
                return(oMessage.Body.Split(",").FirstOrDefault(x => x.Contains("\"key\"")).Split(":")[1].Trim('"'));
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"Hubo un error tratando de conectarse al WebSocket {sUrl}, chequea que onda");
                Console.ResetColor();
                return("");
            }
        }