public async Task UnWatch(string id) { WatchMessage q = new WatchMessage(); q.msg.command = "unwatch"; q.id = id; q = await q.SendMessage <WatchMessage>(this); if (!string.IsNullOrEmpty(q.error)) { throw new Exception(q.error); } if (watches.ContainsKey(id)) { watches.Remove(id); } }
public async Task <string> Watch(string collectionname, string aggregates, WatchEventDelegate onWatchEvent) { WatchMessage q = new WatchMessage(); q.collectionname = collectionname; q.aggregates = JArray.Parse(aggregates); q = await q.SendMessage <WatchMessage>(this); if (!string.IsNullOrEmpty(q.error)) { throw new Exception(q.error); } if (!watches.ContainsKey(q.id)) { watches.Add(q.id, onWatchEvent); } return(q.id); }