fix: send filters to new clients
This commit is contained in:
@ -42,7 +42,7 @@ public class NostrListener : IDisposable
|
|||||||
_ = nostrWebsocketClient.Communicator.Stop(WebSocketCloseStatus.NormalClosure, string.Empty);
|
_ = nostrWebsocketClient.Communicator.Stop(WebSocketCloseStatus.NormalClosure, string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddCommunicators(List<Uri> relays)
|
private void AddCommunicators(List<Uri> relays)
|
||||||
{
|
{
|
||||||
var missing = relays.Where(a => _client.FindClient(ClientName(a)) == null);
|
var missing = relays.Where(a => _client.FindClient(ClientName(a)) == null);
|
||||||
@ -51,6 +51,14 @@ public class NostrListener : IDisposable
|
|||||||
{
|
{
|
||||||
_client.RegisterCommunicator(comm);
|
_client.RegisterCommunicator(comm);
|
||||||
comm.Start();
|
comm.Start();
|
||||||
|
var client = _client.FindClient(comm.Name);
|
||||||
|
if (client != default)
|
||||||
|
{
|
||||||
|
foreach (var (k, v) in _subscriptionToFilter)
|
||||||
|
{
|
||||||
|
client.Send(new NostrRequest(k, v));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +130,7 @@ public class NostrListener : IDisposable
|
|||||||
|
|
||||||
var relays = await db.Relays.Select(a => a.Url).ToListAsync(cancellationToken: stoppingToken);
|
var relays = await db.Relays.Select(a => a.Url).ToListAsync(cancellationToken: stoppingToken);
|
||||||
_nostrListener.AddCommunicators(relays);
|
_nostrListener.AddCommunicators(relays);
|
||||||
|
|
||||||
await Task.Delay(TimeSpan.FromMinutes(10), stoppingToken);
|
await Task.Delay(TimeSpan.FromMinutes(10), stoppingToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user