public Task Send(string content, string connectionId = null) { SendContent value = PublicMethod.JsonDeSerialize <SendContent>(content); if (value == null) { return(Task.CompletedTask); } value.Deliver = String.IsNullOrEmpty(value.Deliver) ? PublicMethod.CombinationString(_baseconnectionHub.HubToken, selfUrl) : value.Deliver; string newContent = PublicMethod.JsonSerialize(value); string[] info = PublicMethod.SplitString(value.Deliver); CacheInfo cache = String.IsNullOrEmpty(connectionId) ? null : HubSelector(value.Target); List <ClientInfo> clients = ClientSelector(info[0], value.Target); if (clients.Count > 0 && !String.IsNullOrEmpty(value.Target)) { foreach (ClientInfo client in clients) { switch (client.ConnectionType) { case ConnectionType.Client: case ConnectionType.Hub: case ConnectionType.Service: sendSignal(newContent, client); break; case ConnectionType.Group: sendGroup(newContent, client, connectionId); break; } } } else if (cache != null) { if (cache.ClientToken != value.From) { ConnectionInfo connection = SubConnection(cache).Result; connection.HubConnection.InvokeAsync("Send", newContent); } } else if (!String.IsNullOrEmpty(value.Target)) { } else { broadcast(newContent, connectionId); } if (_cacheList.Where(x => x.ClientToken == value.From).FirstOrDefault() == null && _List.Where(x => x.ClientToken == value.From).FirstOrDefault() == null && _List.Where(x => x.ClientToken == info[0]).FirstOrDefault() == null) { _cacheList.Add(new CacheInfo() { ClientToken = value.From, Token = info[0], Url = info[1] + "?connectionType=SubHub" }); } return(Task.CompletedTask); }