mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 02:24:17 +00:00
fix path mounting
This commit is contained in:
parent
4ced55f293
commit
68e5fdfecb
@ -5,6 +5,7 @@ import BuiltInEvents from "./events"
|
||||
|
||||
class RTEngineNG {
|
||||
constructor(config = {}) {
|
||||
this.config = config
|
||||
this.events = new Map()
|
||||
|
||||
if (typeof config.events === "object") {
|
||||
@ -24,8 +25,6 @@ class RTEngineNG {
|
||||
|
||||
clients = new Map()
|
||||
|
||||
router = new HyperExpress.Router()
|
||||
|
||||
senders = {
|
||||
broadcast: async (event, data) => {
|
||||
for (const [socketId, client] of this.clients) {
|
||||
@ -153,10 +152,8 @@ class RTEngineNG {
|
||||
attach = async (engine) => {
|
||||
this.engine = engine
|
||||
|
||||
this.router.ws("/", this.handleConnection)
|
||||
this.router.upgrade("/", this.handleUpgrade)
|
||||
|
||||
this.engine.app.use("/", this.router)
|
||||
this.engine.app.ws(this.config.path ?? `/`, this.handleConnection)
|
||||
this.engine.app.upgrade(this.config.path ?? `/`, this.handleUpgrade)
|
||||
}
|
||||
|
||||
close = () => {
|
||||
|
@ -67,6 +67,7 @@ export default class HyperExpressEngineNG {
|
||||
|
||||
if (this.ctx.constructor.enableWebsockets === true) {
|
||||
this.ws = global.websocket = new rtengineng({
|
||||
path: this.ctx.constructor.wsPath,
|
||||
onUpgrade: this.ctx.handleWsUpgrade,
|
||||
onConnection: this.ctx.handleWsConnection,
|
||||
onDisconnect: this.ctx.handleWsDisconnect,
|
||||
|
Loading…
x
Reference in New Issue
Block a user