chore: use modern websockets instead of legacy (#3278)
This commit is contained in:
@@ -7,8 +7,7 @@ from typing import Optional
|
||||
import httpx
|
||||
from loguru import logger
|
||||
from pydantic import BaseModel
|
||||
from websockets.legacy.client import connect
|
||||
from websockets.typing import Subprotocol
|
||||
from websockets import Subprotocol, connect
|
||||
|
||||
from lnbits import bolt11
|
||||
from lnbits.helpers import normalize_endpoint
|
||||
|
||||
@@ -9,7 +9,7 @@ from typing import Any, Optional
|
||||
|
||||
import httpx
|
||||
from loguru import logger
|
||||
from websockets.legacy.client import connect
|
||||
from websockets import connect
|
||||
|
||||
from lnbits.helpers import normalize_endpoint
|
||||
from lnbits.settings import settings
|
||||
@@ -245,7 +245,9 @@ class EclairWallet(Wallet):
|
||||
try:
|
||||
async with connect(
|
||||
self.ws_url,
|
||||
extra_headers=[("Authorization", self.headers["Authorization"])],
|
||||
additional_headers=[
|
||||
("Authorization", self.headers["Authorization"])
|
||||
],
|
||||
) as ws:
|
||||
while settings.lnbits_running:
|
||||
message = await ws.recv()
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing import Optional
|
||||
|
||||
import httpx
|
||||
from loguru import logger
|
||||
from websockets.legacy.client import connect
|
||||
from websockets import connect
|
||||
|
||||
from lnbits.helpers import normalize_endpoint
|
||||
from lnbits.settings import settings
|
||||
|
||||
@@ -10,7 +10,7 @@ from urllib.parse import parse_qs, unquote, urlparse
|
||||
import secp256k1
|
||||
from bolt11 import decode as bolt11_decode
|
||||
from loguru import logger
|
||||
from websockets.legacy.client import connect as ws_connect
|
||||
from websockets import connect as ws_connect
|
||||
|
||||
from lnbits.settings import settings
|
||||
from lnbits.utils.nostr import (
|
||||
|
||||
@@ -9,7 +9,7 @@ from typing import Any, Optional
|
||||
import httpx
|
||||
from httpx import RequestError, TimeoutException
|
||||
from loguru import logger
|
||||
from websockets.legacy.client import connect
|
||||
from websockets import connect
|
||||
|
||||
from lnbits.helpers import normalize_endpoint
|
||||
from lnbits.settings import settings
|
||||
@@ -300,7 +300,9 @@ class PhoenixdWallet(Wallet):
|
||||
try:
|
||||
async with connect(
|
||||
self.ws_url,
|
||||
extra_headers=[("Authorization", self.headers["Authorization"])],
|
||||
additional_headers=[
|
||||
("Authorization", self.headers["Authorization"])
|
||||
],
|
||||
) as ws:
|
||||
logger.info("connected to phoenixd invoices stream")
|
||||
while settings.lnbits_running:
|
||||
|
||||
Reference in New Issue
Block a user