feat: 收發消息
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import EventCallbackFunction from "../typedef/EventCallbackFunction.ts"
|
||||
import ApiManager from "./ApiManager.ts"
|
||||
import { CallMethod } from './ApiDeclare.ts'
|
||||
import { CallMethod, ClientEvent } from './ApiDeclare.ts'
|
||||
import User from "../data/User.ts"
|
||||
import Token from "./Token.ts"
|
||||
import * as SocketIo from "socket.io"
|
||||
|
||||
export default abstract class BaseApi {
|
||||
abstract getName(): string
|
||||
@@ -34,4 +35,7 @@ export default abstract class BaseApi {
|
||||
if (!name.startsWith(this.getName() + ".")) throw Error("注冊的事件應該與接口集合命名空間相匹配: " + name)
|
||||
ApiManager.addEventListener(name, func)
|
||||
}
|
||||
emitToClient(client: SocketIo.Socket, name: ClientEvent, args: { [key: string]: unknown }) {
|
||||
client.emit("The_White_Silk", name, args)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user