I am trying to call a console app method from SignalR HUB context which is not working-
var hubContext = GlobalHost.ConnectionManager.GetHubContext<Hubsfile.MyHub>();
hubContext.Clients.All.SendControl(machine, code);
This (another function below) is working fine as the client is the webpage itself(i think).
hubContext.Clients.All.registerCard(ip, data);
But when I am trying to call a method that is from different client(a console application) , Hub context is not calling it.
Does Hub context doesnt work for clients outside of the Hub Application.
Edit:
Method in SignalR HUB:
public void SendControlKeys(string machine, string code)
{
Clients.All.SendControl(machine, code);
}
Method in Console client:
proxy.On<string, string>("SendControl", (ip, data) =>
{
Console.WriteLine("server called SendControl");
Console.WriteLine();
byte[] dataBytes = HexEncoding.GetBytes(data, out int i);
try
{
lock (Clients)
{
if (Clients.Count > 0)
{
foreach (KeyValuePair<string, StateObject> client in Clients)
{
if (isClientConnected(client.Value.workSocket))
{
if (client.Key == ip)
{
Send(client.Value.workSocket, dataBytes);
break;
}
}
}
}
}
}catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
});
proxy.Start(); // await or .Wait()is called after this call toproxy.On<T>()? - reckface