mirror of
https://github.com/ianramzy/decentralized-video-chat.git
synced 2025-02-23 00:15:04 +08:00
fix everyone gets chat msgs, fix fb adding to url
This commit is contained in:
parent
a0030f1b12
commit
ab8e43012e
@ -1,7 +1,13 @@
|
||||
// strip url parameters
|
||||
if (window.location.href.indexOf('?') > -1) {
|
||||
window.location.href = window.location.href.split('?')[0];
|
||||
}
|
||||
|
||||
if (window.location.pathname === "/room") {
|
||||
window.location.href = "/landing/newroom";
|
||||
}
|
||||
|
||||
|
||||
url = window.location.href;
|
||||
const roomHash = url.substring(url.lastIndexOf('/') + 1).toLowerCase();
|
||||
document.title = 'Neon Chat - ' + url.substring(url.lastIndexOf('/') + 1);
|
||||
@ -569,7 +575,7 @@ var socket = VideoChat.socket;
|
||||
input.addEventListener('keypress', function (event) {
|
||||
if (event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
socket.emit('chat message', input.value);
|
||||
socket.emit('chat message', input.value, roomHash);
|
||||
$('.chat-messages').append('<div class="message-item customer"><div class="message-bloc"><div class="message">' + input.value + '</div></div></div>');
|
||||
$('#chat-zone').scrollTop($('#chat-zone')[0].scrollHeight);
|
||||
input.value = '';
|
||||
|
@ -88,7 +88,7 @@ io.on('connection', function (socket) {
|
||||
|
||||
// Relay answers
|
||||
socket.on('sendCaptions', function (captions, room) {
|
||||
logIt(captions, room);
|
||||
// logIt(captions, room);
|
||||
socket.broadcast.to(room).emit('recieveCaptions', captions);
|
||||
});
|
||||
|
||||
@ -99,8 +99,8 @@ io.on('connection', function (socket) {
|
||||
});
|
||||
|
||||
// Relay chat messages
|
||||
socket.on('chat message', function(msg){
|
||||
socket.broadcast.emit('chat message', msg);
|
||||
socket.on('chat message', function(msg, room){
|
||||
socket.broadcast.to(room).emit('chat message', msg);
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user