Reworked message format, added support for audio messages, made Message class #10
9
app.js
9
app.js
@ -212,7 +212,8 @@ async function handleConnection(connection, info) {
|
|||||||
const iconMessage = JSON.stringify({
|
const iconMessage = JSON.stringify({
|
||||||
type: 'icon',
|
type: 'icon',
|
||||||
username: config.userName,
|
username: config.userName,
|
||||||
avatar: b4a.toString(iconBuffer, 'base64')
|
avatar: b4a.toString(iconBuffer, 'base64'),
|
||||||
|
timestamp: Date.now()
|
||||||
});
|
});
|
||||||
console.log('Sending icon to new peer:', iconMessage);
|
console.log('Sending icon to new peer:', iconMessage);
|
||||||
connection.write(iconMessage);
|
connection.write(iconMessage);
|
||||||
@ -292,7 +293,8 @@ function setupTalkButton() {
|
|||||||
audio: b4a.toString(buffer, 'base64'),
|
audio: b4a.toString(buffer, 'base64'),
|
||||||
audioType: audioBlob.type,
|
audioType: audioBlob.type,
|
||||||
avatar: updatePortInUrl(config.userAvatar),
|
avatar: updatePortInUrl(config.userAvatar),
|
||||||
topic: topic
|
topic: topic,
|
||||||
|
timestamp: Date.now()
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('Sending audio message:', audioMessage); // Debugging log
|
console.log('Sending audio message:', audioMessage); // Debugging log
|
||||||
@ -594,7 +596,8 @@ async function handleFileInput(event) {
|
|||||||
file: b4a.toString(buffer, 'base64'),
|
file: b4a.toString(buffer, 'base64'),
|
||||||
fileType: file.type,
|
fileType: file.type,
|
||||||
avatar: updatePortInUrl(config.userAvatar),
|
avatar: updatePortInUrl(config.userAvatar),
|
||||||
topic: topic
|
topic: topic,
|
||||||
|
timestamp: Date.now()
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('Sending file message:', fileMessage); // Debugging log
|
console.log('Sending file message:', fileMessage); // Debugging log
|
||||||
|
Loading…
Reference in New Issue
Block a user