0
public Task Disconnect()
    {
        var context = new HaiTaxiContainer();
        var driver = context.OperatorEmployeeSet.Where(o => o.ConnectionId == Context.ConnectionId).FirstOrDefault();
        driver.IsWorking = false;
        driver.OperatorWorkingHistory.Add(new OperatorWorkingHistory
        {
            IsWorking = false,
            Time = DateTime.Now

        });
        return Clients.leave(Context.ConnectionId, DateTime.Now.ToString()); ;
    }

if (chat.disconnect!=null){
         chat.disconnect(function () {
                alert('Server has disconnected');
            });
             alert('Server disconnect==smt');
        }else{
            alert('Server disconnect==null');
        }

The client chat.disconect is null. ANy ideeas why?

Ryan
  • 5,456
  • 25
  • 71
  • 129

1 Answers1

0

Based on your code it is hard to tell what you are actually doing - e.g., what is chat ? However, I think you should take a look at this related question / answer: https://stackoverflow.com/a/9122242/700926 about "How to determine server disconnection from SignalR client?" - it might be useful.

Community
  • 1
  • 1
Lasse Christiansen
  • 10,205
  • 7
  • 50
  • 79