|
|
@ -1,16 +1,16 @@ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 会话消息类型枚举 |
|
|
|
* 会话消息类型枚举 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
export const enum WorkerMessageType { |
|
|
|
export const WorkerMessageType = { |
|
|
|
REQUEST = 'REQUEST', |
|
|
|
REQUEST: 'REQUEST', |
|
|
|
REPLY = 'REPLY', |
|
|
|
REPLY: 'REPLY', |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 会话消息 |
|
|
|
* 会话消息 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
export interface IWorkerMessage { |
|
|
|
export interface IWorkerMessage { |
|
|
|
messageType: WorkerMessageType; |
|
|
|
messageType: string; |
|
|
|
actionType: string; |
|
|
|
actionType: string; |
|
|
|
sessionId: string; |
|
|
|
sessionId: string; |
|
|
|
|
|
|
|
|
|
|
@ -30,3 +30,19 @@ export interface IWorkerController { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
actionHandler: (message: IWorkerMessage) => Promise<any>; |
|
|
|
actionHandler: (message: IWorkerMessage) => Promise<any>; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Worker创建配置 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
export interface IWorkerOptions { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* worker 资源 url |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
workerUrl: string; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* worker 实例名称 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
workerName: string; |
|
|
|
|
|
|
|
} |