http sse 消息上报模式
This commit is contained in:
1 parent
15156bac1e
commit
88fd1f9eb1
4 files changed
+84
-4
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { OB11NetworkReloadType } from './index';
|
||||
import { OB11EmitEventContent, OB11NetworkReloadType } from './index';
|
||||
import express, { Express, Request, Response } from 'express';
|
||||
import http from 'http';
|
||||
import { NapCatCore } from '@/core';
|
||||
@@ -17,7 +17,7 @@ export class OB11PassiveHttpAdapter extends IOB11NetworkAdapter<HttpServerConfig
|
||||
super(name, config, core, obContext, actions);
|
||||
}
|
||||
|
||||
onEvent() {
|
||||
onEvent<T extends OB11EmitEventContent>(event: T) {
|
||||
// http server is passive, no need to emit event
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export class OB11PassiveHttpAdapter extends IOB11NetworkAdapter<HttpServerConfig
|
||||
}
|
||||
}
|
||||
|
||||
private async handleRequest(req: Request, res: Response) {
|
||||
async handleRequest(req: Request, res: Response) {
|
||||
if (!this.isEnable) {
|
||||
this.core.context.logger.log(`[OneBot] [HTTP Server Adapter] Server is closed`);
|
||||
return res.json(OB11Response.error('Server is closed', 200));
|
||||
|
||||
Reference in new issue
Block a user