mardi 25 août 2015

Not able to call client method on OnDisconnected

I've a disconnect method in TestHub(which is inherited by Hub) class for signal R. I'm not able to call javascript method fnDeleteCustomer from OnDisconnected method, however same same js method gets called on Connect method. What I'm doing wrong?

 public override Task OnDisconnected()
        {
            try
            {
                 var customer = ConnectedUsers.Find(x => x.ConnectionID == Context.ConnectionId);
                if (customer!=null)
                {
                  Clients.Client(customer.ConnectionID).fnDeleteCustomer(customer.UserId);
                  return base.OnDisconnected();
                }
            }
            catch { };
            return null;
        }

Aucun commentaire:

Enregistrer un commentaire