Skip to content

Commit

Permalink
fix(node, uws): send data as blob only if it is not string (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
TecToast authored Feb 10, 2025
1 parent 5336e9b commit 9a8d499
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/adapters/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class NodePeer extends Peer<{

send(data: unknown, options?: { compress?: boolean }) {
const dataBuff = toBufferLike(data);
const isBinary = typeof data !== "string";
const isBinary = typeof dataBuff !== "string";
this._internal.ws.send(dataBuff, {
compress: options?.compress,
binary: isBinary,
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/uws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class UWSPeer extends Peer<{

send(data: unknown, options?: { compress?: boolean }): number {
const dataBuff = toBufferLike(data);
const isBinary = typeof data !== "string";
const isBinary = typeof dataBuff !== "string";
return this._internal.uws.send(dataBuff, isBinary, options?.compress);
}

Expand Down

0 comments on commit 9a8d499

Please sign in to comment.