Exemplo n.º 1
0
        public static async Task <SignalRCliente> CreateAndStart(string url)
        {
            var client = new SignalRCliente(url);
            await client.Start();

            return(client);
        }
Exemplo n.º 2
0
        private static async Task Enviar(float lat, float lon, int agente, int empresa, string nombre)
        {
            await signalRCliente.Start().ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    Console.WriteLine("Error", "An error occurred when trying to connect to SignalR: " + task.Exception.InnerExceptions[0].Message);
                }
            }
                                                      );

            LivePositionRequest lpr = new LivePositionRequest
            {
                EmpresaId = empresa,
                AgenteId  = agente,
                fecha     = DateTime.Now,
                Lat       = lat,
                Lon       = lon,
                Nombre    = nombre,
            };

            //try to reconnect every 10 seconds, just in case

            signalRCliente.SendMessage(lpr);
        }