Merge pull request #7887 from jk-f5/disablepolling

Disable Polling Transport When WebSockets Are Enabled and Implement Cleanup Locking Mechanism
This commit is contained in:
Timothy Jaeryang Baek
2024-12-18 18:32:56 -08:00
committed by GitHub
4 changed files with 85 additions and 32 deletions

View File

@@ -38,13 +38,14 @@
let loaded = false;
const BREAKPOINT = 768;
const setupSocket = () => {
const setupSocket = (enableWebsocket) => {
const _socket = io(`${WEBUI_BASE_URL}` || undefined, {
reconnection: true,
reconnectionDelay: 1000,
reconnectionDelayMax: 5000,
randomizationFactor: 0.5,
path: '/ws/socket.io',
transports: enableWebsocket ? ['websocket'] : ['polling', 'websocket'],
auth: { token: localStorage.token }
});
@@ -126,7 +127,7 @@
await WEBUI_NAME.set(backendConfig.name);
if ($config) {
setupSocket();
setupSocket($config.features?.enable_websocket ?? true);
if (localStorage.token) {
// Get Session User Info