mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
feat: Make ENABLE_WEBSOCKET_SUPPORT disable polling entirely to allow multiple replicas without sticky sessions.
See https://socket.io/docs/v4/using-multiple-nodes/ for details why this was done. Also create a redis key to track which replica is running the cleanup job
This commit is contained in:
@@ -38,13 +38,15 @@
|
||||
let loaded = false;
|
||||
const BREAKPOINT = 768;
|
||||
|
||||
const setupSocket = () => {
|
||||
const setupSocket = (disableWebSocketPolling) => {
|
||||
console.log('Disabled websocket polling', disableWebSocketPolling);
|
||||
const _socket = io(`${WEBUI_BASE_URL}` || undefined, {
|
||||
reconnection: true,
|
||||
reconnectionDelay: 1000,
|
||||
reconnectionDelayMax: 5000,
|
||||
randomizationFactor: 0.5,
|
||||
path: '/ws/socket.io',
|
||||
transports: disableWebSocketPolling ? ['websocket'] : ['polling', 'websocket'],
|
||||
auth: { token: localStorage.token }
|
||||
});
|
||||
|
||||
@@ -125,8 +127,9 @@
|
||||
await config.set(backendConfig);
|
||||
await WEBUI_NAME.set(backendConfig.name);
|
||||
|
||||
const disableWebSocketPolling = backendConfig.features.disable_websocket_polling === true;
|
||||
if ($config) {
|
||||
setupSocket();
|
||||
setupSocket(disableWebSocketPolling);
|
||||
|
||||
if (localStorage.token) {
|
||||
// Get Session User Info
|
||||
|
||||
Reference in New Issue
Block a user