小编M. *_*ris的帖子

如何使用 AspNetCore SignalR 创建集线器代理

有人知道 AspNet SignalR 中这段代码的等效 AspNetCore SignalR 吗?

Task.Factory.StartNew(() =>
{
    ////  var clients = Hub.Clients<RealTimeNotificationHub>();
    var connection = new HubConnectionContext("https://demohouse.go.ro:96/");
    var notificationmessag = new AlertMessage();
    notificationmessag.Content = "New message from " + device.Name + " <b>" +
                                 text + " </b>";
    notificationmessag.Title = alertType.Name;
    var myHub = connection.CreateHubProxy("realTimeNotificationHub");
    connection.Start().Wait();
    object[] myData = { notificationmessag.Title, notificationmessag.Content };
    myHub.Invoke("sendMessage", myData).Wait();
    connection.Stop();
});
Run Code Online (Sandbox Code Playgroud)

c# signalr asp.net-core

6
推荐指数
1
解决办法
3622
查看次数

标签 统计

asp.net-core ×1

c# ×1

signalr ×1