Skip to content

Commit

Permalink
moved ready message from API files to serve.js
Browse files Browse the repository at this point in the history
  • Loading branch information
RealMCoded committed Sep 10, 2023
1 parent 3a1b2ca commit 2ba88b0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
1 change: 0 additions & 1 deletion servers/2016/APIServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ async function serve() {

app.listen(port, () => {
console.log(`${chalk.green("[API]")} API started on port ${port}`)
console.log(`${chalk.yellowBright("Servers are ready! Please start your build now.")}`)
})
}

Expand Down
1 change: 0 additions & 1 deletion servers/2017/APIServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ async function serve() {

app.listen(port, () => {
console.log(`${chalk.green("[API]")} API started on port ${port}`)
console.log(`${chalk.yellowBright("Servers are ready! Please start your build now.")}`)
})
}

Expand Down
1 change: 0 additions & 1 deletion servers/2018/APIServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ function serve() {

app.listen(port, () => {
console.log(`${chalk.green("[API]")} API started on port ${port}`)
console.log(`${chalk.yellowBright("Servers are ready! Please start your build now.")}`)
})
}

Expand Down
30 changes: 30 additions & 0 deletions servers/shared/WSServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@ const { ports, privateRooms } = require("../../config.json")
const { userid } = require('../../user-info/user.json')

let port;

const ResponseResults = {
RelationshipChanged: 1,
MessageReceived: 2,
MessageDeleted: 3,
PresenceHeartbeatResponse: 4,
SubscriptionListUpdated: 9,
SubscriptionUpdateProfile: 11,
SubscriptionUpdatePresence: 12,
SubscriptionUpdateGameSession: 13,
SubscriptionUpdateRoom: 15,
ModerationQuitGame: 20,
ModerationUpdateRequired: 21,
ModerationKick: 22,
ModerationKickAttemptFailed: 23,
ServerMaintenance: 25,
GiftPackageReceived: 30,
ProfileJuniorStatusUpdate: 40,
RelationshipsInvalid: 50,
StorefrontBalanceAdd: 60,
ConsumableMappingAdded: 70,
ConsumableMappingRemoved: 71,
PlayerEventCreated: 80,
PlayerEventUpdated: 81,
PlayerEventDeleted: 82,
PlayerEventResponseChanged: 83,
PlayerEventResponseDeleted: 84,
PlayerEventStateChanged: 85,
ChatMessageReceived: 90
};

function start(servePort = ports.WS){
try {
Expand Down
3 changes: 3 additions & 0 deletions src/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function run(ver, port) {
console.log(`${chalk.gray("[INFO]")} Starting 2016 server...`)
require("../servers/2016/APIServer.js").start(port)
require("../servers/shared/WSServer.js").start()
console.log(`${chalk.yellowBright("Server is ready! Please start your build now.")}`)
} break;
case "2017": {
if (autorunBuild) {console.log(`${chalk.gray("[INFO]")} Starting 2017 client...`); try{child_process.exec(buildPaths.rr2017)}catch(err){console.error(`${chalk.red('[ERROR]')} Something bad happened when trying to launch your build!\n\n${err.message}`)}}
Expand All @@ -28,6 +29,7 @@ function run(ver, port) {
require("../servers/2017/APIServer.js").start(port)
require("../servers/shared/WSServer.js").start()
require("../servers/shared/CDN.js").start()
console.log(`${chalk.yellowBright("Server is ready! Please start your build now.")}`)
} break;
case "2018": {
if (autorunBuild) {console.log(`${chalk.gray("[INFO]")} Starting 2018 client...`); try{child_process.exec(buildPaths.rr2017)}catch(err){console.error(`${chalk.red('[ERROR]')} Something bad happened when trying to launch your build!\n\n${err.message}`)}}
Expand All @@ -37,6 +39,7 @@ function run(ver, port) {
require("../servers/shared/WSServer.js").start()
require("../servers/2018/NS.js").start()
require("../servers/shared/CDN.js").start()
console.log(`${chalk.yellowBright("Server is ready! Please start your build now.")}`)
} break;
default: {console.error(`${chalk.red('[ERROR]')} Invalid version specified.\n${tryText}`)} break;
}
Expand Down

0 comments on commit 2ba88b0

Please sign in to comment.