mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 21:10:49 +00:00
Merge pull request #151 from overleaf/jpa-perf-parser
[perf] add a few short cuts to the packet decoding
This commit is contained in:
commit
5b85e0154d
1 changed files with 10 additions and 0 deletions
|
@ -47,3 +47,13 @@ function patchedFrameHandler(opcode, str) {
|
|||
}
|
||||
return outputBuffer;
|
||||
}
|
||||
|
||||
const parser = require('socket.io/lib/parser')
|
||||
const decodePacket = parser.decodePacket
|
||||
parser.decodePacket = function (data) {
|
||||
if (typeof data !== 'string') return {}
|
||||
const firstColon = data.indexOf(':')
|
||||
if (firstColon === -1) return {}
|
||||
if (data.indexOf(':', firstColon + 1) === -1) return {}
|
||||
return decodePacket(data)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue