summaryrefslogtreecommitdiff
path: root/server/src/server.ts
diff options
context:
space:
mode:
authorNick Van Doorn <vandoorn.nick@gmail.com>2019-03-02 16:28:36 -0800
committerNick Van Doorn <vandoorn.nick@gmail.com>2019-03-02 16:28:36 -0800
commit16de86a07d156dcd675047198be6273f7dbeadfa (patch)
tree5705ec252e147b9ec80991ef6c985911c0653758 /server/src/server.ts
parent8a01f0eda203c58fd171749cad3973551985ead7 (diff)
Stringify only once
Diffstat (limited to 'server/src/server.ts')
-rw-r--r--server/src/server.ts7
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)
}
}
)