open-webui/src/lib/components/common
Classic298 89716ea880
perf: stop scanning every socket.io payload for binary data (#28180)
* perf: stop scanning every socket.io payload for binary data

Every socket.io event the backend sends was first walked recursively to check whether any value was a bytes object needing binary attachment framing. Open WebUI never emits binary, so the walk always came back empty and the work was thrown away. It has no early exit and allocates at every level, so it scaled with the full size of the message, and the messages are the big ones: chat streaming re-emits the whole assistant message on every update, note collaboration sends document state as a JSON array with one entry per byte. With the Redis manager it ran once per instance per emit on top of that, since every instance builds its own copy of the packet.

The server now installs a Packet subclass with binary events off, through python-socketio's own serializer hook, the same mechanism its msgpack serializer uses. Inbound binary attachments are decoded to int lists rather than refused, so the one frontend path that sends a raw Uint8Array keeps working and handlers can still echo client data straight back out. One scan remains in multi-instance setups: python-socketio's Redis manager calls it on the base Packet class directly, where the serializer hook cannot reach.

Measured per encode:

| payload | before | after |
|---|---|---|
| chat completion re-emit (7.5 KB JSON) | 30 us | 13 us |
| collaborative document state (292 KB JSON) | 9.0 ms | 1.7 ms |

With ENABLE_ORJSON=true, where the scan is nearly the whole encode cost: 20 us to 2.3 us, and 7.8 ms to 0.14 ms.

Closes #28164

* fix: match the other Yjs emits and send the full state as an array

Collaboration.ts sent the initial full-document state as a raw Uint8Array while the other two Yjs emit sites convert with Array.from first. socket.io framed that one as a binary attachment, so with the JSON-only packet class the server turns it into a list of ints and re-broadcasts it as JSON: a 10240-byte state update becomes 36561 JSON characters. Converting at the emit site keeps the wire form uniform across all three sites.

Also trims the JSONOnlyPacket docstring, which claimed attachments already arrive as int lists when the override is what converts them, and annotates the new reconstruct_binary parameters.
2026-08-31 01:22:06 -04:00
..
RichTextInput perf: stop scanning every socket.io payload for binary data (#28180) 2026-08-31 01:22:06 -04:00
Tags refac 2026-08-10 18:52:18 -06:00
Valves feat: Dynamically load leaflet to improve first-screen loading speed 2025-09-17 08:20:56 +00:00
AccessButton.svelte refac 2026-08-20 12:56:45 -07:00
Badge.svelte refac 2026-08-10 18:52:18 -06:00
Banner.svelte refac 2026-07-14 04:15:20 -04:00
ChatList.svelte refac 2026-07-14 04:15:20 -04:00
Checkbox.svelte refac 2026-08-12 00:51:12 -06:00
CodeEditor.svelte fix: mount the code editor in its own container so duplicated message renders don't collide (#27740) 2026-08-24 07:34:07 -04:00
CodeEditorModal.svelte fix: render code editor drawer above settings modal (#27648) 2026-08-23 13:44:41 -04:00
Collapsible.svelte refac 2026-08-10 23:37:45 -06:00
ConfirmDialog.svelte fix: expose ConfirmDialog with dialog role and label its input (WCAG 4.1.2, 3.3.2) (#26769) 2026-07-27 01:15:12 -04:00
DocxPreview.svelte refac 2026-08-24 18:06:59 -04:00
DragGhost.svelte refac 2026-03-22 22:01:38 -05:00
Drawer.svelte fix: render code editor drawer above settings modal (#27648) 2026-08-23 13:44:41 -04:00
Dropdown.svelte refac 2026-07-27 03:59:12 -04:00
DropdownMenu.svelte refac 2026-08-28 13:40:45 -04:00
DropdownOptions.svelte refac 2026-08-10 18:52:18 -06:00
DropdownSub.svelte refac 2026-07-26 18:02:33 -04:00
Emoji.svelte enh: emoji folder icon 2025-09-04 02:50:50 +04:00
EmojiPicker.svelte refac 2026-08-10 18:52:18 -06:00
ExperimentalBadge.svelte refac 2026-08-13 19:59:11 -06:00
FileItem.svelte refac 2026-08-22 08:21:53 -04:00
FileItemModal.svelte fix: give docx and pptx previews in the file modal a definite frame height (#28878) 2026-08-22 08:11:29 -04:00
Folder.svelte a11y 2026-08-11 01:25:20 -06:00
FullHeightIframe.svelte Merge pull request #26914 from Classic298/srcdoc-embed-prompt-confirmation 2026-07-10 13:28:39 -05:00
HotkeyHint.svelte feat: add setting to toggle keyboard shortcuts on/off (#27300) 2026-07-23 22:14:56 -04:00
Image.svelte refac 2026-08-13 02:03:13 -06:00
ImagePreview.svelte refac 2026-08-23 13:47:02 -04:00
InputModal.svelte refac 2026-07-14 04:15:20 -04:00
InterfaceSettings.svelte refac 2026-08-30 12:36:16 -04:00
Loader.svelte fix: message delete issue 2025-06-02 23:25:38 +04:00
Marquee.svelte feat: onboarding screen 2024-11-03 03:00:28 -08:00
MobileSwipePanel.svelte refac 2026-08-30 21:41:03 -04:00
Modal.svelte fix: restore per-item retrieval settings in the model editor knowledge section (#27686) 2026-08-24 07:34:30 -04:00
MultiSelect.svelte refac 2026-08-12 00:51:12 -06:00
NativeSelect.svelte refac 2026-06-29 05:14:03 -05:00
Overlay.svelte refac 2026-07-14 04:15:20 -04:00
Pagination.svelte refac 2026-08-10 18:52:18 -06:00
PanzoomContainer.svelte refac 2026-08-15 01:09:39 -06:00
PdfPagesPreview.svelte refac 2026-08-27 16:41:43 -04:00
PDFViewer.svelte refac 2026-08-30 17:45:50 -04:00
PptxPreview.svelte refac 2026-08-30 17:45:50 -04:00
ResizableSidePanel.svelte refac 2026-08-30 12:42:13 -04:00
RichTextInput.svelte refac 2026-08-24 21:15:54 -04:00
Select.svelte fix: keep select dropdowns inside the viewport (#29226) 2026-08-30 12:06:27 -04:00
Selector.svelte refac 2026-07-14 04:15:20 -04:00
SensitiveInput.svelte fix: give SensitiveInput a unique default id (WCAG 1.3.1, 4.1.2) (#27488) 2026-07-26 17:37:45 -04:00
SettingsSelect.svelte refac 2026-07-15 18:26:29 -04:00
Sidebar.svelte refac: styling 2025-01-17 17:03:25 -08:00
SlideShow.svelte chore: streamline the URL used for resources like favicon.png 2025-07-09 09:14:51 +02:00
Spinner.svelte refac: styling 2025-06-27 16:15:16 +04:00
SplitCreateButton.svelte refac 2026-08-12 00:51:12 -06:00
SVGPanZoom.svelte refactor(SVGPanZoom): Fix memory leaking - consolidate zoom lifecycle into PanzoomContainer (#23236) 2026-03-30 20:54:28 -05:00
Switch.svelte refac 2026-08-12 00:51:12 -06:00
Tags.svelte refac 2026-08-10 18:52:18 -06:00
Textarea.svelte refac 2026-07-26 17:51:49 -04:00
ToolCallDisplay.svelte refac 2026-08-23 02:34:08 -04:00
Tooltip.svelte fix: Fix Tooltip memory leaking and type define (#21969) 2026-02-28 14:01:28 -05:00
Valves.svelte fix: prevent valve inputs from overflowing the valves modal (#29203) 2026-08-29 14:52:29 -04:00