使用ASP.NET的在线支持

时间:2019-01-08 16:39:09

标签: c# asp.net signalr override

我收到此错误消息:

  

严重性代码LError CS0115'ChatConnection.OnDisconnected(IRequest,string)':找不到合适的方法来覆盖

这是我的代码:

 protected override Task OnDisconnected(IRequest request, string connectionId)
    {
        if (!string.IsNullOrEmpty(group_ids[0]) && !string.IsNullOrEmpty(group_ids[1]) && !group_ids.Contains(connectionId))
        {
            waiting_users = CustomQ<string>.RemoveItem(waiting_users, connectionId);
            return base.OnDisconnected(request, connectionId);
        }

        if (string.IsNullOrEmpty(group_ids[1]))
        {
            return base.OnDisconnected(request, connectionId);
        }

        sb.Append("====chat ends====\n");           
        string message = sb.ToString();
        sb.Clear();
        SaveChatToFile(message);

        if (connectionId == operator_id)
        {
            OnlineSupport.operator_online = false;
            operator_added_to_group = false;
            group_ids[0] = string.Empty;
            group_ids[1] = string.Empty;
            waiting_users.Clear();
            return Connection.Broadcast("Operator is offline now");
        }
        else
        {
            group_ids[1] = string.Empty;
            if (waiting_users.Count > 0)
            {
                group_ids[1] = waiting_users.Dequeue();
                return Task.Factory.StartNew(() =>
                {
                    Connection.Send(group_ids[1], "You are now connected to operator");
                    Connection.Send(group_ids[0], string.Format("================User has left================<br/>New User has joined you"));
                });
                //return base.OnConnected(request, connectionId);
            }
            else
            {
                return Connection.Send(group_ids[0], string.Format("==============User has left===============<br/>There are no users in a queue"));
            }
        }       
    }

如何解决此错误?

0 个答案:

没有答案