Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions sdks/typescript/pmxt/ws-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,19 @@ export class SidecarWsClient {
const raw = typeof event.data === "string"
? event.data
: event.data.toString();
const msg: WsMessage = JSON.parse(raw);
this.dispatch(msg);
let msg: WsMessage;
try {
msg = JSON.parse(raw);
} catch {
// Non-JSON control frame -- ignore.
return;
}
try {
this.dispatch(msg);
} catch (err) {
// Dispatch bug -- log and continue; don't kill the connection.
console.error('[SidecarWsClient] dispatch error:', err);
}
};
});
}
Expand Down
Loading