fix: copilot websocket connections

This commit is contained in:
Stefan Stammberger
2021-10-16 13:35:50 +02:00
parent 570e8d28dd
commit cb6f9e1f72
2 changed files with 4 additions and 5 deletions

View File

@@ -239,8 +239,7 @@
':' + ':' +
location.port + location.port +
'/copilot/ws/' + '/copilot/ws/' +
self.copilot.id + self.copilot.id
'/'
} else { } else {
localUrl = localUrl =
'ws://' + 'ws://' +
@@ -248,8 +247,7 @@
':' + ':' +
location.port + location.port +
'/copilot/ws/' + '/copilot/ws/' +
self.copilot.id + self.copilot.id
'/'
} }
this.connection = new WebSocket(localUrl) this.connection = new WebSocket(localUrl)
this.connection.onmessage = function (e) { this.connection.onmessage = function (e) {

View File

@@ -1,4 +1,5 @@
from http import HTTPStatus from http import HTTPStatus
from typing import List
import httpx import httpx
from collections import defaultdict from collections import defaultdict
from lnbits.decorators import check_user_exists from lnbits.decorators import check_user_exists
@@ -70,7 +71,7 @@ class ConnectionManager:
manager = ConnectionManager() manager = ConnectionManager()
@copilot_ext.websocket("/ws/{socket_id}") @copilot_ext.websocket("/copilot/ws/{socket_id}", name="copilot.websocket_by_id")
async def websocket_endpoint(websocket: WebSocket, socket_id: str): async def websocket_endpoint(websocket: WebSocket, socket_id: str):
await manager.connect(websocket) await manager.connect(websocket)
try: try: