From ef1c840aa77aa5e1ec10088371074d189d0124fa Mon Sep 17 00:00:00 2001 From: azivner Date: Wed, 2 Jan 2019 22:36:06 +0100 Subject: [PATCH] tiny fixes --- src/entities/entity_constructor.js | 3 ++- src/services/messaging.js | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/entities/entity_constructor.js b/src/entities/entity_constructor.js index f96979a03..b7ee4b313 100644 --- a/src/entities/entity_constructor.js +++ b/src/entities/entity_constructor.js @@ -15,7 +15,8 @@ const ENTITY_NAME_TO_ENTITY = { "note_revisions": NoteRevision, "recent_notes": RecentNote, "options": Option, - "api_tokens": ApiToken + "api_tokens": ApiToken, + "links": Link }; function getEntityFromEntityName(entityName) { diff --git a/src/services/messaging.js b/src/services/messaging.js index 520197a0b..2ac650ac2 100644 --- a/src/services/messaging.js +++ b/src/services/messaging.js @@ -52,13 +52,15 @@ async function sendMessage(client, message) { async function sendMessageToAllClients(message) { const jsonStr = JSON.stringify(message); - log.info("Sending message to all clients: " + jsonStr); + if (webSocketServer) { + log.info("Sending message to all clients: " + jsonStr); - webSocketServer.clients.forEach(function each(client) { - if (client.readyState === WebSocket.OPEN) { - client.send(jsonStr); - } - }); + webSocketServer.clients.forEach(function each(client) { + if (client.readyState === WebSocket.OPEN) { + client.send(jsonStr); + } + }); + } } async function sendPing(client, lastSentSyncId) {