Skip to content

Commit

Permalink
Fix serialization for websocket adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkpiano committed Apr 22, 2024
1 parent bd1087c commit 76a599f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/webSocket.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { InspectorOptions, createInspector } from './createInspector';
import {
InspectorOptions,
createInspector,
defaultInspectorOptions,
} from './createInspector';
import { Adapter, StatelyInspectionEvent } from './types';
import WebSocket from 'isomorphic-ws';
import safeStringify from 'safe-stable-stringify';
Expand Down Expand Up @@ -32,7 +36,14 @@ export class WebSocketAdapter implements Adapter {
console.log('websocket open');
this.status = 'open';
this.deferredEvents.forEach((inspectionEvent) => {
const serializedEvent = this.options.serialize(inspectionEvent);
const preSerializedEvent = defaultInspectorOptions.serialize(
inspectionEvent,
inspectionEvent
);
const serializedEvent = this.options.serialize(
preSerializedEvent,
inspectionEvent
);
this.ws.send(safeStringify(serializedEvent));
});
};
Expand Down

0 comments on commit 76a599f

Please sign in to comment.