lunel-cli 0.1.86 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,9 +49,9 @@ export class V2SessionTransport {
49
49
  this.state = "open";
50
50
  resolve();
51
51
  });
52
- ws.on("message", async (data) => {
52
+ ws.on("message", async (data, isBinary) => {
53
53
  try {
54
- await this.handleMessage(data);
54
+ await this.handleMessage(data, isBinary);
55
55
  }
56
56
  catch (error) {
57
57
  this.options.debugLog?.("[transport:v2] message handling failed", error);
@@ -103,9 +103,10 @@ export class V2SessionTransport {
103
103
  }
104
104
  this.ws = null;
105
105
  }
106
- async handleMessage(data) {
107
- if (typeof data === "string") {
108
- const raw = JSON.parse(data);
106
+ async handleMessage(data, isBinary) {
107
+ if (!isBinary) {
108
+ const text = typeof data === "string" ? data : Buffer.from(data).toString("utf-8");
109
+ const raw = JSON.parse(text);
109
110
  if ("type" in raw) {
110
111
  await this.options.handlers.onSystemMessage(raw);
111
112
  if (raw.type === "peer_connected") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lunel-cli",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
4
4
  "author": [
5
5
  {
6
6
  "name": "Soham Bharambe",