新增 通过 Websocket 获取状态

This commit is contained in:
Suwings 2021-07-17 13:36:22 +08:00
parent 415240b128
commit 739504111c

View File

@ -1,7 +1,7 @@
/*
* @Author: Copyright(c) 2020 Suwings
* @Date: 2021-06-22 22:44:06
* @LastEditTime: 2021-07-16 19:25:05
* @LastEditTime: 2021-07-17 13:21:26
* @Description:
* @Projcet: MCSManager Daemon
* @License: MIT
@ -62,6 +62,23 @@ routerApp.on("stream/auth", (ctx, data) => {
}
});
// 获取实例详细信息
routerApp.on("stream/detail", (ctx) => {
try {
const instanceUuid = ctx.session.stream.instanceUuid;
const instance = InstanceSubsystem.getInstance(instanceUuid);
protocol.response(ctx, {
instanceUuid: instance.instanceUuid,
started: instance.startCount,
status: instance.status(),
config: instance.config,
info: instance.info
});
} catch (error) {
protocol.responseError(ctx, error);
}
});
// 列出指定实例工作目录的文件列表
routerApp.on("stream/input", (ctx, data) => {