/// <summary> /// 客户端重新连接 /// </summary> /// <returns></returns> public override Task OnReconnected() { string mac = MacUtils.GetClientMAC(HttpContext.Current.Request); string id = Context.ConnectionId; Debug.WriteLine($" Reconnected : mac = {mac} ; id = {id}"); return(base.OnReconnected()); }
/// <summary> /// 客户端连接 /// </summary> public void Connection() { string mac = MacUtils.GetClientMAC(HttpContext.Current.Request); Cache.DeleteCache(mac); string id = Context.ConnectionId; Debug.WriteLine($" Connected : mac = {mac} ; id = {id}"); //将客户端websocket Id存起来 Cache.SetCache(mac, id); Clients.Client(id).Reciver(mac, id); }