diff options
author | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-03-02 16:28:36 -0800 |
---|---|---|
committer | Nick Van Doorn <vandoorn.nick@gmail.com> | 2019-03-02 16:28:36 -0800 |
commit | 16de86a07d156dcd675047198be6273f7dbeadfa (patch) | |
tree | 5705ec252e147b9ec80991ef6c985911c0653758 /server/src/server.ts | |
parent | 8a01f0eda203c58fd171749cad3973551985ead7 (diff) |
Stringify only once
Diffstat (limited to 'server/src/server.ts')
-rw-r--r-- | server/src/server.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/src/server.ts b/server/src/server.ts index 1cb441b..0973518 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -21,8 +21,13 @@ export const runServer = async (ctx: Context): Promise<CleanupRoutine> => { ctx, db, async (dbChange: DatabaseChange) => { + const changeBuff = JSON.stringify(dbChange) + // TODO figure out if `client` cares about + // `dbChange` instead of just assuming that + // `client` cares because `subscribe` has been + // called at least once for (let client of wss.clients) { - client.send(JSON.stringify(dbChange)) + client.send(changeBuff) } } ) |