EOSE works

This commit is contained in:
callebtc 2023-03-09 14:42:31 +01:00
parent 8a6adb4768
commit cba039d041
4 changed files with 54 additions and 10 deletions

View file

@ -6,7 +6,12 @@ from .models import RelayList, Relay, Event, Filter, Filters
from .nostr.event import Event as NostrEvent
from .nostr.filter import Filter as NostrFilter
from .nostr.filter import Filters as NostrFilters
from .tasks import client, received_event_queue, received_subscription_events
from .tasks import (
client,
received_event_queue,
received_subscription_events,
received_subscription_eosenotices,
)
from fastapi import WebSocket, WebSocketDisconnect
from lnbits.helpers import urlsafe_short_hash
@ -73,6 +78,13 @@ class NostrRouter:
# send data back to client
await self.websocket.send_text(json.dumps(event_to_forward))
if s in received_subscription_eosenotices:
my_event = received_subscription_eosenotices[s]
s_original = s[len(f"{self.subscription_id_rewrite}_") :]
event_to_forward = ["EOSE", s_original]
del received_subscription_eosenotices[s]
# send data back to client
await self.websocket.send_text(json.dumps(event_to_forward))
await asyncio.sleep(0.1)
async def start(self):