Skip to content

Commit

Permalink
🎯 Better efficiency
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashu11-A committed Jun 18, 2024
1 parent fe30681 commit 0566f4c
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 7 deletions.
40 changes: 40 additions & 0 deletions core/package-lock.json

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

5 changes: 5 additions & 0 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"crypto-js": "^4.2.0",
"discord.js": "^14.15.3",
"dotenv": "^16.4.5",
"eiows": "^7.0.3",
"express": "^4.19.2",
"glob": "^10.4.1",
"isbinaryfile": "^5.0.2",
Expand All @@ -62,5 +63,9 @@
"socket.io": "^4.7.5",
"typeorm": "^0.3.20",
"yargs": "^17.7.2"
},
"optionalDependencies": {
"bufferutil": "^4.0.8",
"utf-8-validate": "^5.0.10"
}
}
13 changes: 9 additions & 4 deletions core/src/controller/socket.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
import express, { type Application } from 'express'
import { createServer } from 'http'
import { Server } from 'socket.io'
import ws from 'ws'
import { Event } from './events.js'
import eiows from 'node_modules/eiows/dist/eiows.js'

export class SocketController {
protected readonly app: Application
public server
static io: Server

constructor () {
constructor() {
this.app = express()
this.server = createServer(this.app)
SocketController.io = new Server(this.server, { path: '/socket.io' })
SocketController.io = new Server(this.server, {
path: '/socket.io',
wsEngine: process.platform !== 'win32' ? eiows.Server : ws.Server
})
}

listen (port: string) {
listen(port: string) {
this.server.listen(port, () => {
console.log(`🚀 Servidor inicializado na porta ${port}`)
})
}

ready () {
ready() {
SocketController.io.on('connection', async (client) => new Event({ client }).controller())
}
}
45 changes: 44 additions & 1 deletion plugins/plugin_base/package-lock.json

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

4 changes: 4 additions & 0 deletions plugins/plugin_base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@
"reflect-metadata": "^0.1.13",
"socket.io-client": "^4.7.5",
"typeorm": "0.3.20"
},
"optionalDependencies": {
"bufferutil": "^4.0.8",
"utf-8-validate": "^5.0.10"
}
}
45 changes: 44 additions & 1 deletion plugins/tickets/package-lock.json

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

4 changes: 4 additions & 0 deletions plugins/tickets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,9 @@
"reflect-metadata": "^0.1.14",
"socket.io-client": "^4.7.5",
"typeorm": "^0.3.20"
},
"optionalDependencies": {
"bufferutil": "^4.0.8",
"utf-8-validate": "^5.0.10"
}
}
Loading

0 comments on commit 0566f4c

Please sign in to comment.