Reworked message format, added support for audio messages, made Message class #10

Merged
snxraven merged 20 commits from MiTask/LinkUp-P2P-Chat:main into main 2024-06-14 14:15:43 -04:00
Showing only changes of commit bb26b5c2a8 - Show all commits

9
app.js
View File

@ -212,8 +212,7 @@ async function handleConnection(connection, info) {
const iconMessage = JSON.stringify({
type: 'icon',
username: config.userName,
avatar: b4a.toString(iconBuffer, 'base64'),
timestamp: Date.now()
avatar: b4a.toString(iconBuffer, 'base64')
});
console.log('Sending icon to new peer:', iconMessage);
connection.write(iconMessage);
@ -293,8 +292,7 @@ function setupTalkButton() {
audio: b4a.toString(buffer, 'base64'),
audioType: audioBlob.type,
avatar: updatePortInUrl(config.userAvatar),
topic: topic,
timestamp: Date.now()
topic: topic
};
console.log('Sending audio message:', audioMessage); // Debugging log
@ -596,8 +594,7 @@ async function handleFileInput(event) {
file: b4a.toString(buffer, 'base64'),
fileType: file.type,
avatar: updatePortInUrl(config.userAvatar),
topic: topic,
timestamp: Date.now()
topic: topic
};
console.log('Sending file message:', fileMessage); // Debugging log