SignalR:使用GlobalHost.ConnectionManager发送数据无法查看方法

时间:2016-05-24 11:55:25

标签: c# signalr

我是SignalR的新手,所以我可能会遗漏一些基本的东西。

使用时:

public class EventDispatcher : Hub
{
    void Send(string sStrategyID, string sMessage)
    {
        var context = GlobalHost.ConnectionManager.GetHubContext<EventDispatcher>();
        context.Clients.All.broadcastMessage(sStrategyID, sMessage);
    }
}

客户识别eventDispatcher但不识别broadcastMessage

    $(function () {
        var chat = $.connection.eventDispatcher;
        chat.client.broadcastMessage = function (sStrategyID, sMessage) {
            console.log("Id: " + sStrategyID + " ,Event: " + sMessage);
        };
    });

watch

0 个答案:

没有答案