-
Notifications
You must be signed in to change notification settings - Fork 567
/
interface.ts
35 lines (30 loc) 路 994 Bytes
/
interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import * as SocketIO from 'socket.io';
import {
CommonMiddlewareUnion,
ContextMiddlewareManager,
IConfigurationOptions,
IMidwayApplication,
IMidwayContext,
NextFunction as BaseNextFunction
} from '@midwayjs/core';
export type Application = IMidwayApplication<Context, {
use(fn: (socket: Context, fn: (err?: any) => void) => void): SocketIO.Namespace;
useConnectionMiddleware: (
middleware: CommonMiddlewareUnion<Context, NextFunction, undefined>
) => void;
getConnectionMiddleware: ContextMiddlewareManager<Context, NextFunction, undefined>;
} & SocketIO.Server>;
export type IMidwaySocketIOOptions = {
port?: number;
pubClient?: any;
subClient?: any;
} & Partial<SocketIO.ServerOptions> & IConfigurationOptions;
export type Context = IMidwayContext<SocketIO.Socket & {
app: Application
}>;
export type NextFunction = BaseNextFunction;
declare module '@midwayjs/core/dist/interface' {
interface MidwayConfig {
socketIO?: IMidwaySocketIOOptions;
}
}