SignalR:在上下文之外访问context.ConnectionId

时间:2013-11-14 06:40:28

标签: asp.net signalr

我有这段代码

public async void Update(Order order, string notes, List<OrderMenu> oMenu, long userId)
    {
        var hubContext = GlobalHost.ConnectionManager.GetHubContext<PostHub>();
        await hubContext.Groups.Add(Context.ConnectionId, userId.ToString());}

我通过像这样创建集线器对象来从服务器调用此方法

ROS.PostHub po = new ROS.PostHub();
            try
            {
                po.Update(new ROS.Order()

但context.ConnectionId返回null。

0 个答案:

没有答案