/*
Function return array of all clients connected to server or channel
*/
function getClients(channelId) {
var channel, channels, clients = [];
channels = getChannels();
if (typeof channelId == 'undefined') {
for(var i = 0; i < channels.length; i++){
channel = channels[i];
clients.push(channel.clients);
}
return clients;
} else {
for(var i = 0; i < channels.length; i++){
channel = channels[i];
if(channel.id == channelId){
return channel.clients;
break;
}
}
}
return [];
};