mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 21:58:39 -09:00
use string based RPC for data events for better perf
This commit is contained in:
parent
12bda394be
commit
9f9da68408
2 changed files with 5 additions and 2 deletions
|
|
@ -233,7 +233,7 @@ app.on('ready', () => installDevExtensions(isDev).then(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
session.on('data', data => {
|
session.on('data', data => {
|
||||||
rpc.emit('session data', {uid, data});
|
rpc.emit('session data', uid + data);
|
||||||
});
|
});
|
||||||
|
|
||||||
session.on('exit', () => {
|
session.on('exit', () => {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,10 @@ rpc.on('session add', data => {
|
||||||
// debouncing, to reduce allocation and iterations
|
// debouncing, to reduce allocation and iterations
|
||||||
let req;
|
let req;
|
||||||
let objects = {};
|
let objects = {};
|
||||||
rpc.on('session data', ({uid, data}) => {
|
rpc.on('session data', d => {
|
||||||
|
// the uid is a uuid v4 so it's 36 chars long
|
||||||
|
const uid = d.slice(0, 36);
|
||||||
|
const data = d.slice(36);
|
||||||
if (objects[uid] === undefined) {
|
if (objects[uid] === undefined) {
|
||||||
objects[uid] = data;
|
objects[uid] = data;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue