Add full support for multiple connections with one account in Socket.IO

Add LIST command
This commit is contained in:
knotteye
2019-12-04 19:06:56 -06:00
parent 661d953919
commit be38b873eb
3 changed files with 31 additions and 8 deletions

View File

@ -33,6 +33,9 @@
else if(m.startsWith('/kick')){
socket.emit('KICK', {nick: m.split(' ')[1], room: room});
}
else if(m.startsWith('/list')){
socket.emit('LIST', {room: room});
}
else socket.emit('MSG', {room: room, msg: m});
document.getElementById('m').value = '';
}
@ -52,6 +55,10 @@
document.getElementById('messages').innerHTML+='<li><i>'+data.nick+' has left the chat</i></li>';
window.scrollTo(0,document.body.scrollHeight);
});
socket.on('LIST', function(data){
document.getElementById('messages').innerHTML+='<li><i>'+data+'</i></li>';
window.scrollTo(0,document.body.scrollHeight);
});
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');