mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-23 14:40:47 +01:00
Removed returns and reverted socket check so multiple clients can join
This commit is contained in:
parent
187d709098
commit
31d9f2e2ee
1 changed files with 2 additions and 7 deletions
|
@ -387,24 +387,19 @@ def fee_reserve(amount_msat: int) -> int:
|
|||
class WebsocketConnectionManager:
|
||||
def __init__(self):
|
||||
self.active_connections: List[WebSocket] = []
|
||||
return
|
||||
|
||||
async def connect(self, websocket: WebSocket, item_id: str):
|
||||
await websocket.accept()
|
||||
if item_id not in self.active_connections:
|
||||
websocket.id = item_id
|
||||
self.active_connections.append(websocket)
|
||||
return
|
||||
websocket.id = item_id
|
||||
self.active_connections.append(websocket)
|
||||
|
||||
def disconnect(self, websocket: WebSocket):
|
||||
self.active_connections.remove(websocket)
|
||||
return
|
||||
|
||||
async def send_data(self, message: str, item_id: str):
|
||||
for connection in self.active_connections:
|
||||
if connection.id == item_id:
|
||||
await connection.send_text(message)
|
||||
return
|
||||
|
||||
|
||||
websocketManager = WebsocketConnectionManager()
|
||||
|
|
Loading…
Add table
Reference in a new issue