Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: v8.18.0 released major breaking change (not minor) and data sent as Blob (not Buffer) #2239

Open
1 task done
titanism opened this issue Jul 4, 2024 · 4 comments
Open
1 task done

Comments

@titanism
Copy link

titanism commented Jul 4, 2024

Is there an existing issue for this?

  • I've searched for any related issues and avoided creating a duplicate issue.

Description

See comment here #2229 (comment)

ws version

8.18.0

Node.js Version

latest

System

No response

Expected result

No response

Actual result

No response

Attachments

No response

@lpinca
Copy link
Member

lpinca commented Jul 4, 2024

Are you are setting websocket.binaryType to 'blob'?

@lpinca
Copy link
Member

lpinca commented Jul 4, 2024

Please share a minimal test case to reproduce the issue. I am unable to do it with the provided info. The following example works as expected.

import { WebSocket, WebSocketServer } from 'ws';
import { pack, unpack } from 'msgpackr';

const wss = new WebSocketServer({ port: 0 }, function () {
  const { port } = wss.address();
  const ws = new WebSocket(`ws://127.0.0.1:${port}`);

  ws.on('open', function () {
    ws.send(pack('Hello'));
  });

  ws.on('message', function (buf) {
    console.log(unpack(buf));
    ws.close();
  });
});

wss.on('connection', function (ws) {
  ws.on('message', function (buf) {
    ws.send(pack(unpack(buf)));
  });

  ws.on('close', function () {
    wss.close();
  });
});

@titanism
Copy link
Author

titanism commented Jul 4, 2024

@titanism are you are setting websocket.binaryType to 'blob'? Let's continue the discussion in #2239.

No, not at the moment. All we did was upgrade to latest version of ws and this issue came about.

@lpinca
Copy link
Member

lpinca commented Jul 5, 2024

Maybe it was already set. It was simply ignored before. I can't help without a test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants