mirror of
https://github.com/aljazceru/python-nostr.git
synced 2025-12-18 23:04:20 +01:00
connection state on connect
This commit is contained in:
@@ -24,7 +24,7 @@ class NostrClient:
|
||||
"wss://lnbits.link/nostrrelay/client",
|
||||
"wss://nostr-pub.wellorder.net",
|
||||
"wss://nostr.zebedee.cloud",
|
||||
"wss://no.str.cr",
|
||||
"wss://nodestr.fmt.wiz.biz",
|
||||
] # ["wss://nostr.oxtr.dev"] # ["wss://relay.nostr.info"] "wss://nostr-pub.wellorder.net" "ws://91.237.88.218:2700", "wss://nostrrr.bublina.eu.org", ""wss://nostr-relay.freeberty.net"", , "wss://nostr.oxtr.dev", "wss://relay.nostr.info", "wss://nostr-pub.wellorder.net" , "wss://relayer.fiatjaf.com", "wss://nodestr.fmt.wiz.biz/", "wss://no.str.cr"
|
||||
relay_manager = RelayManager()
|
||||
private_key: PrivateKey
|
||||
|
||||
@@ -55,13 +55,14 @@ class Relay:
|
||||
def connect(self, ssl_options: dict = None, proxy: dict = None):
|
||||
self.ssl_options = ssl_options
|
||||
self.proxy = proxy
|
||||
self.ws.run_forever(
|
||||
sslopt=ssl_options,
|
||||
http_proxy_host=None if proxy is None else proxy.get("host"),
|
||||
http_proxy_port=None if proxy is None else proxy.get("port"),
|
||||
proxy_type=None if proxy is None else proxy.get("type"),
|
||||
ping_interval=5,
|
||||
)
|
||||
if not self.connected:
|
||||
self.ws.run_forever(
|
||||
sslopt=ssl_options,
|
||||
http_proxy_host=None if proxy is None else proxy.get("host"),
|
||||
http_proxy_port=None if proxy is None else proxy.get("port"),
|
||||
proxy_type=None if proxy is None else proxy.get("type"),
|
||||
ping_interval=5,
|
||||
)
|
||||
|
||||
def close(self):
|
||||
self.ws.close()
|
||||
|
||||
Reference in New Issue
Block a user