private object RtSubscribe(WebSocketHandler ws, string[] expressions) { ws.OnClose -= Ws_OnClose; ws.OnClose += Ws_OnClose; Dictionary <string, string> result = new Dictionary <string, string>(); logger.LogInformation("RtSubscribe {ws} expressions:{@expressions}", ws.GetHashCode(), expressions); lock (wsTags) { wsTags[ws] = expressions .Select(expression => trackerManager.GetOrAdd(connector, expression)) .ToList(); } return(new { tags = wsTags[ws].Select(t => new { tagName = t.TagName, status = t.Status, updated = t.Updated, value = t.ValueObject }).ToArray() }); }
private string RtUnsubscribe(WebSocketHandler ws) { ws.OnClose -= Ws_OnClose; logger.LogInformation("RtUnsubscribe {ws}", ws.GetHashCode()); lock (wsTags) wsTags.Remove(ws, out _); return("ok"); }