Skip to content

Commit

Permalink
Roomname socket for connection
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterbrandsen committed May 26, 2024
1 parent 911711c commit 3de7017
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ DEBUG=FALSE
SCREEPS_TOKEN=""
CHECK_FOR_NEW_ACTIONS=TRUE
API_SETTINGS='{}'
ROOM_NAME='E0N0'

# Postgres
POSTGRES_ENABLED='TRUE'
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"https-proxy-agent": "^7.0.2",
"jest": "^29.7.0",
"postgres": "^3.4.3",
"screeps-advanced-api": "^1.4.8",
"screeps-advanced-api": "^1.5.0",
"screeps-api": "^1.16.0",
"winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1"
Expand Down
5 changes: 3 additions & 2 deletions src/socket/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ if (process.env.PRIVATE_SERVER_USERNAME) {
console.log('Connected to socket')
})

api.socket.subscribe('console')
api.socket.on('console', async (event) => {
const roomName = process.env.ROOM_NAME
api.socket.subscribe(`room:${roomName}`)
api.socket.on(`room:${roomName}`, async (event) => {
try {
const { data } = await axios.get(`${url}/stats`);

Expand Down

0 comments on commit 3de7017

Please sign in to comment.