From 68138efb59e326d7602108b53ce526edab92b187 Mon Sep 17 00:00:00 2001 From: Charlie Brown Date: Tue, 26 Sep 2023 09:24:35 -0500 Subject: [PATCH] Fix support for debugging in the web client --- packages/web/src/client.ts | 4 ++++ packages/web/src/tracing.ts | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/web/src/client.ts b/packages/web/src/client.ts index 66e42cb..799e755 100644 --- a/packages/web/src/client.ts +++ b/packages/web/src/client.ts @@ -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)); diff --git a/packages/web/src/tracing.ts b/packages/web/src/tracing.ts index afaf03d..4590b2a 100644 --- a/packages/web/src/tracing.ts +++ b/packages/web/src/tracing.ts @@ -20,10 +20,9 @@ export async function enableTracing(options: TracingOptions): Promise { 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];