Skip to content

Commit

Permalink
Fix support for debugging in the web client
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonrobot committed Sep 26, 2023
1 parent 1834e69 commit 68138ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/web/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export function WebSocketClient(options: WebSocketClientOptions) {

return {
send: (data: Event) => {
if (options.debug) {
log.debug('sending', data);
}

try {
if (ws.readyState === ws.OPEN) {
ws.send(JSON.stringify(data));
Expand Down
3 changes: 1 addition & 2 deletions packages/web/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ export async function enableTracing(options: TracingOptions): Promise<void> {
if (options.debug) log.info('Starting in debug mode');

const port = options.port ?? DEFAULT_WEB_SOCKET_PORT;
const serviceName = options.serviceName;

// custom websocket client
const ws = WebSocketClient({ port, serviceName });
const ws = WebSocketClient({ ...options, port });

// middleware transforms event data
const middleware: Middleware[] = [Meta, Sanity];
Expand Down

0 comments on commit 68138ef

Please sign in to comment.