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 {
|
class RTEngineNG {
|
||||||
constructor(config = {}) {
|
constructor(config = {}) {
|
||||||
|
this.config = config
|
||||||
this.events = new Map()
|
this.events = new Map()
|
||||||
|
|
||||||
if (typeof config.events === "object") {
|
if (typeof config.events === "object") {
|
||||||
@ -24,8 +25,6 @@ class RTEngineNG {
|
|||||||
|
|
||||||
clients = new Map()
|
clients = new Map()
|
||||||
|
|
||||||
router = new HyperExpress.Router()
|
|
||||||
|
|
||||||
senders = {
|
senders = {
|
||||||
broadcast: async (event, data) => {
|
broadcast: async (event, data) => {
|
||||||
for (const [socketId, client] of this.clients) {
|
for (const [socketId, client] of this.clients) {
|
||||||
@ -153,10 +152,8 @@ class RTEngineNG {
|
|||||||
attach = async (engine) => {
|
attach = async (engine) => {
|
||||||
this.engine = engine
|
this.engine = engine
|
||||||
|
|
||||||
this.router.ws("/", this.handleConnection)
|
this.engine.app.ws(this.config.path ?? `/`, this.handleConnection)
|
||||||
this.router.upgrade("/", this.handleUpgrade)
|
this.engine.app.upgrade(this.config.path ?? `/`, this.handleUpgrade)
|
||||||
|
|
||||||
this.engine.app.use("/", this.router)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
close = () => {
|
close = () => {
|
||||||
|
@ -67,6 +67,7 @@ export default class HyperExpressEngineNG {
|
|||||||
|
|
||||||
if (this.ctx.constructor.enableWebsockets === true) {
|
if (this.ctx.constructor.enableWebsockets === true) {
|
||||||
this.ws = global.websocket = new rtengineng({
|
this.ws = global.websocket = new rtengineng({
|
||||||
|
path: this.ctx.constructor.wsPath,
|
||||||
onUpgrade: this.ctx.handleWsUpgrade,
|
onUpgrade: this.ctx.handleWsUpgrade,
|
||||||
onConnection: this.ctx.handleWsConnection,
|
onConnection: this.ctx.handleWsConnection,
|
||||||
onDisconnect: this.ctx.handleWsDisconnect,
|
onDisconnect: this.ctx.handleWsDisconnect,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user