use string based RPC for data events for better perf

This commit is contained in:
Guillermo Rauch 2017-02-18 00:55:48 -03:00
parent 12bda394be
commit 9f9da68408
2 changed files with 5 additions and 2 deletions

View file

@ -233,7 +233,7 @@ app.on('ready', () => installDevExtensions(isDev).then(() => {
});
session.on('data', data => {
rpc.emit('session data', {uid, data});
rpc.emit('session data', uid + data);
});
session.on('exit', () => {

View file

@ -48,7 +48,10 @@ rpc.on('session add', data => {
// debouncing, to reduce allocation and iterations
let req;
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) {
objects[uid] = data;
} else {