mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-22 16:04:18 +01:00
Refactor streaming to use async iterators
This commit is contained in:
@@ -93,8 +93,8 @@ const isFresh = ({ created_at }: Event): boolean => created_at >= nostrNow() - T
|
||||
function streamOut(event: Event, data: EventData) {
|
||||
if (!isFresh(event)) return;
|
||||
|
||||
for (const { socket, id } of Sub.matches(event, data)) {
|
||||
socket.send(JSON.stringify(['EVENT', id, event]));
|
||||
for (const sub of Sub.matches(event, data)) {
|
||||
sub.stream(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user