diff --git a/index.d.ts b/index.d.ts index 4b8cd172..650f578e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -47,10 +47,11 @@ export interface AppDescriptor { * This because we expect UTF-8, which is packed in 8-byte chars. JavaScript strings are UTF-16 internally meaning extra copies and reinterpretation are required. * * That's why all events pass data by ArrayBuffer and not JavaScript strings, as they allow zero-copy data passing. - * * You can always do Buffer.from(arrayBuffer).toString(), but keeping things binary and as ArrayBuffer is preferred. + * + * The ArrayBufferView type includes Node.js Buffer, DataView, and TypedArray (Uint8Array, Uint16Array, ...). */ -export type RecognizedString = string | ArrayBuffer | Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array | Float64Array; +export type RecognizedString = string | ArrayBuffer | SharedArrayBuffer | ArrayBufferView; /** A WebSocket connection that is valid from open to close event. * Read more about this in the user manual. diff --git a/source_commit b/source_commit index b7cbc3a7..8764ee5a 100644 --- a/source_commit +++ b/source_commit @@ -1 +1 @@ -54e822d6f7bf7377f6367a772e02d5c3914c1b84 +0b0c8f90d3f0b59938c725ca0647458493ee086e diff --git a/uws.js b/uws.js index e67bae1d..d5dcdf59 100644 --- a/uws.js +++ b/uws.js @@ -35,6 +35,7 @@ const toUint8Array = (value) => { if (value === undefined) return new Uint8Array(0); else if (typeof value === 'string') return textEncoder.encode(value); else if (value instanceof ArrayBuffer) return new Uint8Array(value); + else if (value instanceof SharedArrayBuffer) return new Uint8Array(value); else return new Uint8Array(value.buffer, value.byteOffset, value.byteLength); }; diff --git a/uws_linux_arm64_115.node b/uws_linux_arm64_115.node index 0265851b..b2fd58c1 100644 Binary files a/uws_linux_arm64_115.node and b/uws_linux_arm64_115.node differ diff --git a/uws_linux_arm64_127.node b/uws_linux_arm64_127.node index 913e205f..abdc8e7f 100644 Binary files a/uws_linux_arm64_127.node and b/uws_linux_arm64_127.node differ diff --git a/uws_linux_arm64_137.node b/uws_linux_arm64_137.node index bd587e96..90431c85 100644 Binary files a/uws_linux_arm64_137.node and b/uws_linux_arm64_137.node differ diff --git a/uws_linux_arm64_141.node b/uws_linux_arm64_141.node index 5587e634..ebd390ea 100755 Binary files a/uws_linux_arm64_141.node and b/uws_linux_arm64_141.node differ