在连接器上访问对象

时间:2019-06-03 16:03:50

标签: c# signalr.client

我在使用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);

            }

0 个答案:

没有答案