Compare commits
No commits in common. "6e7f0d90945fb6c1a9c5de12b9b7178be44bd405" and "1a730fdb644f98e6764f67ee1ef8dc34f53f8350" have entirely different histories.
6e7f0d9094
...
1a730fdb64
|
@ -6,12 +6,11 @@ I wanted to play the old MSN(r) Messenger(tm) Activities online.
|
||||||
|
|
||||||
## Client compatibility:
|
## Client compatibility:
|
||||||
Server: whatever node.js version uWS supports
|
Server: whatever node.js version uWS supports
|
||||||
|
|
||||||
Client: does it ES6?
|
Client: does it ES6?
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
* Add something!
|
* Client synchronization should be "less bad and less prone to desynching"
|
||||||
|
|
||||||
## Desires
|
## Desires
|
||||||
* Discover more Activities that aren't Flash-based, and hope they don't use some other foregone extension.
|
* Discover more Activities that aren't Flash-based, and hope they don't use some other foregone extension.
|
||||||
* Pray Ruffle finally starts supporting the scripability APIs needed to support Flash-based activities.
|
* Pray Ruffle finally starts supporting the scripability APIs needed to support Flash-based activities.
|
|
@ -184,7 +184,7 @@ channelSocket.onmessage = function(event) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
__messengerjs__.fade.textContent = "server error: " + args[1] + " code (" + args[2] + ")";
|
__messengerjs__.fade.textContent = "server error:" + args[1] + "code (" + args[2] + ")";
|
||||||
__messengerjs__.fade.style.display = "block";
|
__messengerjs__.fade.style.display = "block";
|
||||||
channelSocket.close(1000, "server sent non-zero error");
|
channelSocket.close(1000, "server sent non-zero error");
|
||||||
__messengerjs__.callIfExists("Channel_OnTypeChanged");
|
__messengerjs__.callIfExists("Channel_OnTypeChanged");
|
||||||
|
@ -283,4 +283,4 @@ document.addEventListener("DOMContentLoaded", function(event) {
|
||||||
__messengerjs__.onloadfunction = fn;
|
__messengerjs__.onloadfunction = fn;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
12
server.js
12
server.js
|
@ -1,4 +1,4 @@
|
||||||
const config = {"__proto__": null, port: 9091};
|
const config = {port: 9091};
|
||||||
var uidcounter = 0;
|
var uidcounter = 0;
|
||||||
Object.freeze(config); // Config should not be modified after initialization!
|
Object.freeze(config); // Config should not be modified after initialization!
|
||||||
|
|
||||||
|
@ -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 channel is full
|
// this room 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} (fourCC: ${args2}) for (${webSocket.getUserData().uid})`);
|
console.log(`creating #${getChannelId} 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", `data 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 channel is empty, delete it
|
// if room 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));
|
||||||
|
@ -225,4 +225,4 @@ require("process").on('SIGINT', function() {
|
||||||
require("process").on('SIGINT', function(){console.warn("emergency shutdown was engaged, clients may be confused!");require("process").exit()});
|
require("process").on('SIGINT', function(){console.warn("emergency shutdown was engaged, clients may be confused!");require("process").exit()});
|
||||||
console.log("shutting down server, giving clients 5 seconds...");
|
console.log("shutting down server, giving clients 5 seconds...");
|
||||||
setTimeout(function(){console.log("server stopping now");server.close();require("process").exit()}, 5000)
|
setTimeout(function(){console.log("server stopping now");server.close();require("process").exit()}, 5000)
|
||||||
});
|
});
|
Loading…
Reference in New Issue