private PKTicker(IHubConnectionContext <dynamic> clients) { Clients = clients; _pkInfo = GetCurrentPKInfo(); _timer = new Timer(UpdatePKInfo, null, _updateInterval, _updateInterval); }
public void UpdatePKInfo(object state) { lock (_updatePkInfoLock) { if (!_updatingPkInfo) { _updatingPkInfo = true; // 获取最新数据 _pkInfo = GetCurrentPKInfo(); BroadcastPkInfo(_pkInfo); _updatingPkInfo = false; } } }
private void BroadcastPkInfo(PKInfoModel pkModel) { Clients.All.updatePkInfo(pkModel); }