You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The file socket.io.esm.min.js from the NPM package socket.io-client 4.8.0 contains a bug which breaks binary data when talking to other SocketIO implementations (for example python-socjetio).
Instead of {_placeholder: true, num: 0}, the code produces {it: true, num: 0}. It's correct in the source. The problem is somewhere in the ESM build.
To Reproduce
Search for function _deconstructPacket in socket.io.js. It looks like this:
function _deconstructPacket(data, buffers) {
if (!data) return data;
if (isBinary(data)) {
var placeholder = {
_placeholder: true,
num: buffers.length
};
In the ESM, it gets compiled into this code:
function ot(t, s) {
if (!t)
return t;
if (et(t)) {
const i = {
it: !0,
num: s.length
};
return s.push(t),
i
}
The same happens in _reconstructPacket. Source:
function _reconstructPacket(data, buffers) {
if (!data) return data;
if (data && data._placeholder === true) {
var isIndexValid = typeof data.num === "number" && data.num >= 0 && data.num < buffers.length;
which is compiled into
function ct(t, s) {
if (!t)
return t;
if (t && !0 === t.it) {
if ("number" == typeof t.num && t.num >= 0 && t.num < s.length)
Expected behavior
The binary representation in the serialized message must be correct.
Platform:
Device: any
OS: any
Additional context
n.a.
The text was updated successfully, but these errors were encountered:
The "_placeholder" attribute is used when sending binary data, and was
incorrectly mangled (converted to a random short property, like "it",
to reduce the bundle size).
This bug was introduced in [1], included in `socket.io-client@4.8.0`.
[1]: 7085f0e
Related: #5215
Thanks for the quick response. My workaround is to use a unit test to copy the file into the production folder and patch the two places. So it's not a killer at the moment.
Describe the bug
The file
socket.io.esm.min.js
from the NPM package socket.io-client 4.8.0 contains a bug which breaks binary data when talking to other SocketIO implementations (for example python-socjetio).Instead of
{_placeholder: true, num: 0}
, the code produces{it: true, num: 0}
. It's correct in the source. The problem is somewhere in the ESM build.To Reproduce
Search for
function _deconstructPacket
insocket.io.js
. It looks like this:In the ESM, it gets compiled into this code:
The same happens in
_reconstructPacket
. Source:which is compiled into
Expected behavior
The binary representation in the serialized message must be correct.
Platform:
Additional context
n.a.
The text was updated successfully, but these errors were encountered: