我在使用Signalr客户端的.net core 2.2控制台应用程序中具有以下代码 无论如何,我可以在连接外部访问BroadCastStatus对象。
try
{
connection.On<BroadCastStatus>("BroadCastStatus", (BroadCastJson) =>
{
Console.WriteLine("Broadcast Group:" + BroadCastJson.hubgroup);
Console.WriteLine("Broadcast Mic:" + BroadCastJson.micstatus);
Console.WriteLine("Broadcast Audio Stream:" + BroadCastJson.audiostream);
Console.WriteLine("Broadcast Video Stream:" + BroadCastJson.videostream);
Console.WriteLine("Broadcast tweetID:" + BroadCastJson.tweetid);
//BroadCastJson is not available outside of this scope
});
}
catch (Exception err)
{
Console.Write("error no broadcast " + err.Message);
}