Brief summary
WebSocket.send() should not send the entire underlying ArrayBuffer for type arrays or DataView.
k6 version
1.3.0
OS
Linux
Docker version and image (if applicable)
No response
Steps to reproduce the problem
export default async function() {
const ws = new WebSocket(`wss://echo.websocket.org`);
ws.binaryType = 'arraybuffer';
ws.addEventListener('open', (event) => {
const a = new Uint8Array(1024);
ws.send(a.subarray(0, 1));
});
ws.addEventListener('close', (event) => {
console.log('Closed', event);
})
return new Promise(resolve => {
ws.addEventListener('message', (event) => {
if (event.data instanceof ArrayBuffer) {
console.log("Length", event.data.byteLength);
ws.close();
resolve(undefined);
}
});
})
}
Expected behaviour
Should print:
Actual behaviour
Prints: