Skip to content

Commit

Permalink
Fix encoding buffer to support browsers
Browse files Browse the repository at this point in the history
Normally msgpack-javascript should work out of the box as the output of encode is Uint8array but due to this issue we have to initialise it again as the buffer is missing Ref msgpack/msgpack-javascript#145
  • Loading branch information
nmargaritis committed Jun 16, 2021
1 parent d023f47 commit 481656d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/encoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const buildEncoder = (options = {}) => {

encode(packet) {
const encoded = msgpack.encode(packet, this.options);
const buffer = Buffer.from(encoded);
const buffer = new Uint8Array(encoded);

return [buffer];
}
Expand Down

0 comments on commit 481656d

Please sign in to comment.