From 55b13992ef437123f7c1b2d37db345ebcd0a6cdf Mon Sep 17 00:00:00 2001 From: Denis Carriere Date: Sat, 7 Oct 2023 16:35:58 -0400 Subject: [PATCH] refactor time --- index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index af3663c..64e5919 100644 --- a/index.ts +++ b/index.ts @@ -135,7 +135,8 @@ Bun.serve<{key: string}>({ } if ( method === "time" ) { logger.info('time', {key: ws.data.key, remoteAddress: ws.remoteAddress}); - ws.send(JSON.stringify({id, status: 200, result: {serverTime: Number(Date.now())}})); + const serverTime = Number(Date.now()); + ws.send(JSON.stringify({id, status: 200, result: {serverTime}})); return; }