From 2a7c3d68671bf4a85d3c67f9e710e6a6228bb81a Mon Sep 17 00:00:00 2001 From: Saptak S Date: Sun, 14 Nov 2021 21:06:47 +0530 Subject: [PATCH] Renames message event to chat_message --- cli/onionshare_cli/resources/static/js/chat.js | 2 +- cli/onionshare_cli/web/chat_mode.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/onionshare_cli/resources/static/js/chat.js b/cli/onionshare_cli/resources/static/js/chat.js index 78eaa7bc..2be55488 100644 --- a/cli/onionshare_cli/resources/static/js/chat.js +++ b/cli/onionshare_cli/resources/static/js/chat.js @@ -20,7 +20,7 @@ $(function () { // Triggered when message is received from a user. Even when sent // by self, it get triggered after the server sends back the emit. - socket.on('message', function (data) { + socket.on('chat_message', function (data) { addMessageToPanel(data, current_username, 'chat'); console.log(data, current_username); }); diff --git a/cli/onionshare_cli/web/chat_mode.py b/cli/onionshare_cli/web/chat_mode.py index b8053e0c..5f2e30f5 100644 --- a/cli/onionshare_cli/web/chat_mode.py +++ b/cli/onionshare_cli/web/chat_mode.py @@ -131,7 +131,7 @@ class ChatModeWeb: """Sent by a client when the user entered a new message. The message is sent to all people in the server.""" emit( - "message", + "chat_message", {"username": session.get("name"), "msg": message["msg"]}, broadcast=True, )