mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[PR #18357] [CLOSED] feat(websockets): Enable multi-tab support by isolating WebSocket connections #47811
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/18357
Author: @MyoungHaSong
Created: 10/15/2025
Status: ❌ Closed
Base:
dev← Head:feat/multi-tab-websocket-isolation📝 Commits (1)
3beab85feat(websockets): Isolate WebSocket connections per browser tab📊 Changes
14 files changed (+73 additions, -34 deletions)
View changed files
📝
backend/open_webui/functions.py(+1 -1)📝
backend/open_webui/socket/main.py(+18 -9)📝
backend/open_webui/utils/chat.py(+3 -2)📝
src/lib/components/channel/Channel.svelte(+3 -2)📝
src/lib/components/channel/MessageInput.svelte(+2 -1)📝
src/lib/components/channel/Thread.svelte(+2 -1)📝
src/lib/components/chat/Chat.svelte(+1 -1)📝
src/lib/components/chat/ContentRenderer/FloatingButtons.svelte(+2 -1)📝
src/lib/components/common/RichTextInput.svelte(+5 -0)📝
src/lib/components/layout/Sidebar.svelte(+1 -1)📝
src/lib/components/notes/NoteEditor.svelte(+1 -1)📝
src/lib/stores/index.ts(+1 -1)📝
src/routes/+layout.svelte(+30 -13)📝
vite.config.ts(+3 -0)📄 Description
This change introduces WebSocket connection isolation for each browser tab,
resolving interference issues when multiple Open WebUI tabs are open
simultaneously.
Previously, all tabs shared a single WebSocket event stream, causing messages and
UI updates intended for one tab to incorrectly appear in others. This also led to
connection drops and unresponsive chats.
Key changes:
Backend: The
get_event_emitterfunction now accepts abroadcast: boolparameter. By setting
broadcast=Falsefor user-specific events (like chatstreaming), messages are now directed only to the originating client's session ID
(sid).
Frontend: Refactored the WebSocket handling to use Svelte's Context API. Each
tab's component tree now maintains its own isolated socket instance, preventing
cross-tab state pollution. This affects Chat, Channel, and other real-time
components.
Bug Fix: A
RangeErrorinRichTextInput(ProseMirror) is now guardedagainst, improving editor stability.
Build: Added
y-protocols/awarenesstovite.config.tsoptimizeDeps toprevent potential pre-bundling issues.
Closes #16219
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch.pull request.
Changelog is added at the bottom of the PR
description.
connections, and pipeline requests.
testing.
featprefix used to indicate new feature.Changelog Entry
Description
Enables true multi-tab support by isolating WebSocket connections per browser tab.
Fixes issue where chat responses and UI updates from one tab would incorrectly
appear in other tabs, causing connection interference and unresponsive chats.
Added
broadcastparameter toget_event_emitterfunction for targetedmessage delivery
RichTextInput.svelteto prevent ProseMirror RangeErrorChanged
get_event_emitterinsocket/main.pyto acceptbroadcast: boolparameterutils/chat.pyto usebroadcast=Falsefor chat streamingevents (2 locations)
functions.pyto usebroadcast=Falsefor function executionevents
+layout.svelteto create tab-specific socket instancesusing Context API
store:
Chat.svelteContentRenderer/FloatingButtons.svelteChannel.svelteThread.svelteMessageInput.svelteSidebar.svelteNoteEditor.sveltey-protocols/awarenesstovite.config.tsoptimizeDepsFixed
RichTextInputAdditional Information
Testing performed:
Technical approach:
connections
getContext/setContextto provide tab-local socketinstances
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the
Contributor License Agreement (CLA), and I am providing my contributions under its
terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.