Renames message event to chat_message

This commit is contained in:
Saptak S 2021-11-14 21:06:47 +05:30
parent f4ade1ba8d
commit 2a7c3d6867
No known key found for this signature in database
GPG Key ID: 7B7F1772C0C6FCBF
2 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ $(function () {
// Triggered when message is received from a user. Even when sent // Triggered when message is received from a user. Even when sent
// by self, it get triggered after the server sends back the emit. // 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'); addMessageToPanel(data, current_username, 'chat');
console.log(data, current_username); console.log(data, current_username);
}); });

View File

@ -131,7 +131,7 @@ class ChatModeWeb:
"""Sent by a client when the user entered a new message. """Sent by a client when the user entered a new message.
The message is sent to all people in the server.""" The message is sent to all people in the server."""
emit( emit(
"message", "chat_message",
{"username": session.get("name"), "msg": message["msg"]}, {"username": session.get("name"), "msg": message["msg"]},
broadcast=True, broadcast=True,
) )