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); }
public void SendMessage(LivePositionRequest livePosition) { ChatHubProxy.Invoke("SendPosition", livePosition); }