You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
710 B
48 lines
710 B
/** |
|
* 会话消息类型枚举 |
|
*/ |
|
export const WorkerMessageType = { |
|
REQUEST: 'REQUEST', |
|
REPLY: 'REPLY', |
|
}; |
|
|
|
/** |
|
* 会话消息 |
|
*/ |
|
export interface IWorkerMessage { |
|
messageType: string; |
|
actionType: string; |
|
sessionId: string; |
|
|
|
/** |
|
* 数据交换参数 |
|
*/ |
|
payload: any; |
|
} |
|
|
|
/** |
|
* 通信控制器需要实现的 interface |
|
*/ |
|
export interface IWorkerController { |
|
|
|
/** |
|
* 事务处理器 |
|
*/ |
|
actionHandler: (message: IWorkerMessage) => Promise<any>; |
|
} |
|
|
|
/** |
|
* Worker创建配置 |
|
*/ |
|
export interface IWorkerOptions { |
|
|
|
/** |
|
* worker 资源 url |
|
*/ |
|
workerUrl: string; |
|
|
|
/** |
|
* worker 实例名称 |
|
*/ |
|
workerName: string; |
|
}
|
|
|