irislib / iris-messenger

Decentralized messenger
https://iris.to
MIT License
719 stars 157 forks source link

pubsub: use relay hints #382

Open npub1zenn0 opened 1 year ago

npub1zenn0 commented 1 year ago

Follows referred events' relay hints. Meaning with this, the app will subscribe to events from the relay hinted in e/p tags: e.g. from ['e', <hexkey>, 'wss://nos.lol', 'reply'].

Adds relay hints to published e and p tags.

Fixes published events incorrectly showing up as "Found by Iris.to API".

npub1zenn0 commented 1 year ago

p tags won't usually get the hint because the profiles are fetched from api.iris.to which doesn't provide relay info. Might be worth returning the relays from the api at some point.

npub1zenn0 commented 1 year ago

Worth noting that the referred relays get connected to for the rest of the session. If that turns out to be a problem, e.g. too many websocket connections stack up, then fixing it in the relaypool library is prob for the best.