(socket:any, message: ChatMessageMessage)
| 686 | * @param message the message from the client |
| 687 | */ |
| 688 | const handleChatMessage = async (socket:any, message: ChatMessageMessage) => { |
| 689 | const chatMessage = ChatMessage.fromObject(message.data.message); |
| 690 | const {padId, author: authorId} = sessioninfos[socket.id]; |
| 691 | // Don't trust the user-supplied values. |
| 692 | chatMessage.time = Date.now(); |
| 693 | chatMessage.authorId = authorId; |
| 694 | await exports.sendChatMessageToPadClients(chatMessage, padId); |
| 695 | }; |
| 696 | |
| 697 | /** |
| 698 | * Adds a new chat message to a pad and sends it to connected clients. |
no test coverage detected