Spaces:
Sleeping
Sleeping
Commit ·
8c0f057
1
Parent(s): 203a546
Update WebSocket URL protocol to dynamically handle HTTP/HTTPS and pass `Settings` instance to `WebSocketManager`.
Browse files
main.py
CHANGED
|
@@ -17,7 +17,7 @@ from core.types.datamodels import (
|
|
| 17 |
)
|
| 18 |
from core.utils.utils import current_utc_iso
|
| 19 |
|
| 20 |
-
settings =
|
| 21 |
manager = WebSocketManager(settings=settings)
|
| 22 |
|
| 23 |
logger = manager.logger
|
|
@@ -131,7 +131,8 @@ async def get_test_page():
|
|
| 131 |
function connect() {
|
| 132 |
const userId = document.getElementById('userId').value;
|
| 133 |
const roles = document.getElementById('roles').value;
|
| 134 |
-
const
|
|
|
|
| 135 |
|
| 136 |
ws = new WebSocket(url);
|
| 137 |
|
|
|
|
| 17 |
)
|
| 18 |
from core.utils.utils import current_utc_iso
|
| 19 |
|
| 20 |
+
settings = Settings()
|
| 21 |
manager = WebSocketManager(settings=settings)
|
| 22 |
|
| 23 |
logger = manager.logger
|
|
|
|
| 131 |
function connect() {
|
| 132 |
const userId = document.getElementById('userId').value;
|
| 133 |
const roles = document.getElementById('roles').value;
|
| 134 |
+
const protocol = window.location.protocol === "https:" ? "wss" : "ws";
|
| 135 |
+
const url = `${protocol}://${window.location.host}/ws/${userId}?roles=${roles}`;
|
| 136 |
|
| 137 |
ws = new WebSocket(url);
|
| 138 |
|