summary refs log tree commit diff
path: root/src/gateway/util/Send.ts
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2023-12-11 01:12:54 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2023-12-11 01:12:54 +0100
commit0a8ceb9e6349284e75545a01ffad608b020f78e2 (patch)
tree17a9163f963eddabf9168b0b630096b2f7535b64 /src/gateway/util/Send.ts
parentPrettier: use editorconfig (diff)
downloadserver-dev/emma-refactors.tar.xz
Actually run prettier dev/emma-refactors
Diffstat (limited to '')
-rw-r--r--src/gateway/util/Send.ts14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/gateway/util/Send.ts b/src/gateway/util/Send.ts

index 57f87d8b..86f75a9a 100644 --- a/src/gateway/util/Send.ts +++ b/src/gateway/util/Send.ts
@@ -37,15 +37,13 @@ const recurseJsonReplace = (json: any) => { json[key] = JSONReplacer.call(json, key, json[key]); - if (typeof json[key] == "object" && json[key] !== null) - json[key] = recurseJsonReplace(json[key]); + if (typeof json[key] == "object" && json[key] !== null) json[key] = recurseJsonReplace(json[key]); } return json; }; export function Send(socket: WebSocket, data: Payload) { - if (process.env.WS_VERBOSE) - console.log(`[Websocket] Outgoing message: ${JSON.stringify(data)}`); + if (process.env.WS_VERBOSE) console.log(`[Websocket] Outgoing message: ${JSON.stringify(data)}`); if (process.env.WS_DUMP) { const id = socket.session_id || "unknown"; @@ -54,10 +52,7 @@ export function Send(socket: WebSocket, data: Payload) { await fs.mkdir(path.join("dump", id), { recursive: true, }); - await fs.writeFile( - path.join("dump", id, `${Date.now()}.out.json`), - JSON.stringify(data, null, 2), - ); + await fs.writeFile(path.join("dump", id, `${Date.now()}.out.json`), JSON.stringify(data, null, 2)); })(); } @@ -68,8 +63,7 @@ export function Send(socket: WebSocket, data: Payload) { buffer = erlpack.pack(data); } // TODO: encode circular object - else if (socket.encoding === "json") - buffer = JSON.stringify(data, JSONReplacer); + else if (socket.encoding === "json") buffer = JSON.stringify(data, JSONReplacer); else return; // TODO: compression if (socket.deflate) {