mirror of
https://github.com/ragestudio/linebridge.git
synced 2025-06-09 10:34:17 +00:00
update basicServer
This commit is contained in:
parent
ea664d7f52
commit
a5281898ac
@ -18,10 +18,10 @@ const Controllers = [
|
|||||||
static refName = "TestController"
|
static refName = "TestController"
|
||||||
static useMiddlewares = ["test"]
|
static useMiddlewares = ["test"]
|
||||||
|
|
||||||
on = {
|
channels = {
|
||||||
"epicEvent": (socket, arg1, arg2) => {
|
"epicEvent": (socket, ...args) => {
|
||||||
socket.response("Boom!")
|
console.log(`[SERVER WS EVENT] > ${socket.id} > `, ...args)
|
||||||
socket.fail("Ido not know what to do with this epic event")
|
return socket.res("elo")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +49,7 @@ async function _main() {
|
|||||||
const server = new Server(undefined, Controllers, Middlewares)
|
const server = new Server(undefined, Controllers, Middlewares)
|
||||||
const clientBridge = new Bridge({
|
const clientBridge = new Bridge({
|
||||||
origin: server.HTTPAddress,
|
origin: server.HTTPAddress,
|
||||||
|
wsOrigin: server.WSAddress,
|
||||||
})
|
})
|
||||||
|
|
||||||
await server.initialize()
|
await server.initialize()
|
||||||
@ -59,9 +60,11 @@ async function _main() {
|
|||||||
console.log(error)
|
console.log(error)
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
const wsEpicEvent = await clientBridge.wsEndpoints.epicEvent("Hello", "World")
|
||||||
|
|
||||||
console.log(`[get.test] > ${test}`)
|
console.log(`[get.test] > ${test}`)
|
||||||
console.log(`[get.crashtest] > ${crashTest}`)
|
console.log(`[get.crashtest] > ${crashTest}`)
|
||||||
|
console.log(`[ws.epicEvent] > ${wsEpicEvent}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
_main().catch((error) => {
|
_main().catch((error) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user