mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: add websocket compression
This commit is contained in:
6 files changed
+33
-12
No files matched your search
@@ -8,10 +8,10 @@ const page = new NamedPage('record_detail', async () => {
|
||||
import('diff-dom'),
|
||||
]);
|
||||
|
||||
const sock = new WebSocket(UiContext.ws_prefix + UiContext.socketUrl);
|
||||
const sock = new WebSocket(UiContext.ws_prefix + UiContext.socketUrl, false, true);
|
||||
const dd = new DiffDOM();
|
||||
sock.onmessage = (message) => {
|
||||
const msg = JSON.parse(message.data);
|
||||
sock.onmessage = (_, data) => {
|
||||
const msg = JSON.parse(data);
|
||||
const newStatus = $(msg.status_html);
|
||||
const oldStatus = $('#status');
|
||||
dd.apply(oldStatus[0], dd.diff(oldStatus[0], newStatus[0]));
|
||||
|
||||
@@ -11,12 +11,12 @@ const page = new NamedPage('record_main', async () => {
|
||||
import('diff-dom'),
|
||||
]);
|
||||
|
||||
const sock = new WebSocket(UiContext.ws_prefix + UiContext.socketUrl);
|
||||
const sock = new WebSocket(UiContext.ws_prefix + UiContext.socketUrl, false, true);
|
||||
const dd = new DiffDOM();
|
||||
|
||||
sock.onopen = () => sock.send(JSON.stringify({ rids: UiContext.rids }));
|
||||
sock.onmessage = (message) => {
|
||||
const msg = JSON.parse(message.data);
|
||||
sock.onmessage = (_, data) => {
|
||||
const msg = JSON.parse(data);
|
||||
const $newTr = $(msg.html);
|
||||
const $oldTr = $(`.record_main__table tr[data-rid="${$newTr.attr('data-rid')}"]`);
|
||||
if ($oldTr.length) {
|
||||
|
||||
Reference in new issue
Block a user