rust-socketio icon indicating copy to clipboard operation
rust-socketio copied to clipboard

Buffer is not supported when it's a field in an JS object?

Open HuakunShen opened this issue 1 year ago • 2 comments

I was sending this kind of event, where one field is Buffer.

socket.emit("echo" {
      value: Buffer.from(uuidv4()),
      uuid: uuidv4(),
      createdAt: new Date(),
});

It doesn't seem to work with rust-socketio. When I use string for value I can receive events and payload.

But when I send buffer in field value it doesn't work. rust-socketio doesn't show anything, no payload received and no error.

JavaScript SocketIO supports this, I am wondering if this is supported by rust-socketio (I know pure Bytes is supported).

A solution could be serialize buffer into base64 string, but this will cost extra time and resource.

HuakunShen avatar Nov 06 '23 01:11 HuakunShen

I realized that it can be partially captured by on_any image

But instead of getting the entire JS object, I could only get the binary part.

HuakunShen avatar Nov 06 '23 01:11 HuakunShen

In Postman, this is what's received image

HuakunShen avatar Nov 06 '23 01:11 HuakunShen