Skip to content

Commit 10a88e7

Browse files
committed
gui: compress ws messages
1 parent e8095a3 commit 10a88e7

17 files changed

+96128
-500
lines changed

book/api/websocket.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,35 @@ file.
3838
The API is split into various topics which will be streamed to any and
3939
all connected clients.
4040

41+
## Compression
42+
If desired, the server can optionally compress messages larger than 200
43+
bytes. In order to enable this feature, the client must specify the
44+
`compress-zstd` subprotocol in the opening websocket handshake.
45+
46+
::: code-group
47+
48+
```js [client.js]
49+
client = new WebSocket("ws://localhost:80/websocket", protocols=['compress-zstd']);
50+
client.binaryType = "arraybuffer";
51+
```
52+
53+
```
54+
ws.onmessage = function onmessage(ev: MessageEvent<unknown>) {
55+
if (typeof ev.data === 'string') {
56+
... parse string
57+
} else if (ev.data instanceof ArrayBuffer) {
58+
... decompress then parse
59+
}
60+
};
61+
```
62+
63+
:::
64+
65+
In order to distinguish between compressed and non-compressed messages,
66+
the server will send compressed messages as a binary websocket frame
67+
(i.e. opcode=0x2) and regular messages as a text websocket frame (i.e.
68+
opcode=0x1).
69+
4170
## Keeping Up
4271
The server does not drop information, slow down, or stop publishing the
4372
stream of information if the client cannot keep up. A client that is

src/disco/gui/dist/LICENSE_DEPENDENCIES

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,6 +2857,45 @@ SOFTWARE.
28572857

28582858
---
28592859

2860+
Name: @oneidentity/zstd-js
2861+
Version: 1.0.3
2862+
License: SEE LICENSE IN LICENSE
2863+
Private: false
2864+
Description: Browser side compression library from the official Zstandard library.
2865+
Repository: git+https://github.com/OneIdentity/zstd-js.git
2866+
Homepage: https://github.com/OneIdentity/zstd-js
2867+
Author: Zsombor Szende - @szendezsombor
2868+
Contributors:
2869+
Csaba Tamás - @tamascsaba
2870+
Gergely Szabó - @szaboge
2871+
László Zana - @zanalaci
2872+
License Copyright:
2873+
===
2874+
2875+
MIT License
2876+
2877+
Copyright (c) 2022 One Identity
2878+
2879+
Permission is hereby granted, free of charge, to any person obtaining a copy
2880+
of this software and associated documentation files (the "Software"), to deal
2881+
in the Software without restriction, including without limitation the rights
2882+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2883+
copies of the Software, and to permit persons to whom the Software is
2884+
furnished to do so, subject to the following conditions:
2885+
2886+
The above copyright notice and this permission notice shall be included in all
2887+
copies or substantial portions of the Software.
2888+
2889+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2890+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2891+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2892+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2893+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2894+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2895+
SOFTWARE.
2896+
2897+
---
2898+
28602899
Name: @ag-grid-community/core
28612900
Version: 32.3.4
28622901
License: MIT

src/disco/gui/dist/assets/index-BQlpko9n.js

Lines changed: 0 additions & 144 deletions
This file was deleted.

src/disco/gui/dist/assets/index-B_H6gBRE.js

Lines changed: 0 additions & 251 deletions
This file was deleted.

0 commit comments

Comments
 (0)