parent
e0e5396bd8
commit
6e7f0d9094
|
@ -93,7 +93,7 @@ const MessageParser = function(webSocket, message, isBinary) {
|
||||||
}
|
}
|
||||||
let getChannelId = args[1];
|
let getChannelId = args[1];
|
||||||
if(server.numSubscribers(`channels/${getChannelId}`) >= 2) {
|
if(server.numSubscribers(`channels/${getChannelId}`) >= 2) {
|
||||||
// this room is full
|
// this channel is full
|
||||||
webSocket.send(EncodeCommandString(["error", "channel has too many members", 513]), true);
|
webSocket.send(EncodeCommandString(["error", "channel has too many members", 513]), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -104,12 +104,12 @@ const MessageParser = function(webSocket, message, isBinary) {
|
||||||
}
|
}
|
||||||
if(ChannelStorage.has(getChannelId) === false) {
|
if(ChannelStorage.has(getChannelId) === false) {
|
||||||
// make the channel right then and there
|
// make the channel right then and there
|
||||||
console.log(`creating #${getChannelId} for (${webSocket.getUserData().uid})`);
|
console.log(`creating #${getChannelId} (fourCC: ${args2}) for (${webSocket.getUserData().uid})`);
|
||||||
ChannelStorage.set(getChannelId, {"owner": webSocket.getUserData().uid, "fourCC": args[2]});
|
ChannelStorage.set(getChannelId, {"owner": webSocket.getUserData().uid, "fourCC": args[2]});
|
||||||
};
|
};
|
||||||
if(ChannelStorage.get(getChannelId).fourCC !== args[2]) {
|
if(ChannelStorage.get(getChannelId).fourCC !== args[2]) {
|
||||||
// if the fourCC is not the same as the channel, error as such
|
// if the fourCC is not the same as the channel, error as such
|
||||||
webSocket.send(EncodeCommandString(["error", `activity is incompatible! (You: ${args[2]}, Remote: ${ChannelStorage.get(getChannelId).fourCC}).`, 256]), true);
|
webSocket.send(EncodeCommandString(["error", `Activity is incompatible! (You: ${args[2]}, Remote: ${ChannelStorage.get(getChannelId).fourCC}).`, 256]), true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ const MessageParser = function(webSocket, message, isBinary) {
|
||||||
EncodeCommandString(["remuser", UserAttachedNameStorage.get(webSocket.getUserData().uid)]),
|
EncodeCommandString(["remuser", UserAttachedNameStorage.get(webSocket.getUserData().uid)]),
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
// if room is empty, delete it
|
// if channel is empty, delete it
|
||||||
if(server.numSubscribers(`channels/${UserAttachedChannelStorage.get(webSocket.getUserData().uid)}`) === 0) {
|
if(server.numSubscribers(`channels/${UserAttachedChannelStorage.get(webSocket.getUserData().uid)}`) === 0) {
|
||||||
console.log(`deleting #${UserAttachedChannelStorage.get(webSocket.getUserData().uid)} since (${webSocket.getUserData().uid}) left, leaving it with no members`);
|
console.log(`deleting #${UserAttachedChannelStorage.get(webSocket.getUserData().uid)} since (${webSocket.getUserData().uid}) left, leaving it with no members`);
|
||||||
ChannelStorage.delete(UserAttachedChannelStorage.get(webSocket.getUserData().uid));
|
ChannelStorage.delete(UserAttachedChannelStorage.get(webSocket.getUserData().uid));
|
||||||
|
|
Loading…
Reference in New Issue