[*] 日常优化
This commit is contained in:
@@ -204,8 +204,12 @@ export default {
|
|||||||
* @return 是否执行完成
|
* @return 是否执行完成
|
||||||
*/
|
*/
|
||||||
async callback(response, error) {
|
async callback(response, error) {
|
||||||
const me = this;
|
const {
|
||||||
const { code, message, header, body } = response;
|
code,
|
||||||
|
message,
|
||||||
|
header,
|
||||||
|
body
|
||||||
|
} = response;
|
||||||
const { signal } = header;
|
const { signal } = header;
|
||||||
switch (signal) {
|
switch (signal) {
|
||||||
case "media::track" :
|
case "media::track" :
|
||||||
@@ -213,7 +217,7 @@ export default {
|
|||||||
console.info("新增媒体轨道", clientId, track);
|
console.info("新增媒体轨道", clientId, track);
|
||||||
break;
|
break;
|
||||||
case "client::config" :
|
case "client::config" :
|
||||||
me.roomVisible = true;
|
this.roomVisible = true;
|
||||||
break;
|
break;
|
||||||
case "platform::error":
|
case "platform::error":
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@@ -864,6 +864,9 @@ class Taoyao extends RemoteClient {
|
|||||||
case "session::resume":
|
case "session::resume":
|
||||||
me.defaultSessionResume(message);
|
me.defaultSessionResume(message);
|
||||||
break;
|
break;
|
||||||
|
case "room::broadcast":
|
||||||
|
me.defaultRoomBroadcast(message);
|
||||||
|
break;
|
||||||
case "room::client::list":
|
case "room::client::list":
|
||||||
me.defaultRoomClientList(message);
|
me.defaultRoomClientList(message);
|
||||||
break;
|
break;
|
||||||
@@ -2240,6 +2243,40 @@ class Taoyao extends RemoteClient {
|
|||||||
return response.body;
|
return response.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间广播信令
|
||||||
|
*
|
||||||
|
* @param {*} message 信令消息
|
||||||
|
*/
|
||||||
|
defaultRoomBroadcast(message) {
|
||||||
|
console.debug("房间广播", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间广播信令
|
||||||
|
*
|
||||||
|
* @param {*} message 信令消息
|
||||||
|
*/
|
||||||
|
roomBroadcast(message) {
|
||||||
|
this.push(protocol.buildMessage("room::broadcast", {
|
||||||
|
roomId : this.roomId,
|
||||||
|
...message
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {*} clientId 终端ID
|
||||||
|
*
|
||||||
|
* @returns 终端所有ID
|
||||||
|
*/
|
||||||
|
async roomClientListId(clientId) {
|
||||||
|
const response = await this.request(protocol.buildMessage("room::client::list::id", {
|
||||||
|
roomId : this.roomId,
|
||||||
|
clientId: clientId
|
||||||
|
}));
|
||||||
|
return response.body;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 房间终端列表信令
|
* 房间终端列表信令
|
||||||
*
|
*
|
||||||
@@ -2257,22 +2294,6 @@ class Taoyao extends RemoteClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} clientId 终端ID
|
|
||||||
*
|
|
||||||
* @returns 终端所有ID
|
|
||||||
*/
|
|
||||||
async roomClientListId(clientId) {
|
|
||||||
const me = this;
|
|
||||||
const response = await me.request(
|
|
||||||
protocol.buildMessage("room::client::list::id", {
|
|
||||||
roomId : me.roomId,
|
|
||||||
clientId: clientId
|
|
||||||
})
|
|
||||||
);
|
|
||||||
return response.body;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭房间信令
|
* 关闭房间信令
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,17 +24,17 @@ import com.acgist.taoyao.signal.protocol.ProtocolRoomAdapter;
|
|||||||
*/
|
*/
|
||||||
@Protocol
|
@Protocol
|
||||||
@Description(
|
@Description(
|
||||||
|
memo = "终端所有ID集合:消费者、生产者等等",
|
||||||
body = """
|
body = """
|
||||||
{
|
{
|
||||||
"roomId": "房间ID",
|
"roomId" : "房间ID",
|
||||||
"clientId": "终端ID(可选)"
|
"clientId": "终端ID(可选)"
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
""",
|
""",
|
||||||
flow = "终端=>信令服务->终端",
|
flow = "终端=>信令服务->终端"
|
||||||
memo = "终端所有ID集合:消费者、生产者等等"
|
|
||||||
)
|
)
|
||||||
public class RoomClientListIdProtocol extends ProtocolRoomAdapter {
|
public class RoomClientListIdProtocol extends ProtocolRoomAdapter {
|
||||||
|
|
||||||
|
|||||||
@@ -31,23 +31,23 @@ import com.acgist.taoyao.signal.protocol.ProtocolRoomAdapter;
|
|||||||
"""
|
"""
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"ip": "终端IP",
|
"ip" : "终端IP",
|
||||||
"name": "终端名称",
|
"name" : "终端名称",
|
||||||
"clientId": "终端ID",
|
"clientId" : "终端ID",
|
||||||
"clientType": "终端类型",
|
"clientType" : "终端类型",
|
||||||
"latitude": 纬度,
|
"latitude" : 纬度,
|
||||||
"longitude": 经度,
|
"longitude" : 经度,
|
||||||
"humidity": 湿度,
|
"humidity" : 湿度,
|
||||||
"temperature": 温度,
|
"temperature" : 温度,
|
||||||
"signal": 信号强度(0~100),
|
"signal" : 信号强度(0~100),
|
||||||
"battery": 电池电量(0~100),
|
"battery" : 电池电量(0~100),
|
||||||
"alarming": 是否发生告警(true|false),
|
"alarming" : 是否发生告警(true|false),
|
||||||
"charging": 是否正在充电(true|false),
|
"charging" : 是否正在充电(true|false),
|
||||||
"clientRecording": 是否正在录像(true|false),
|
"clientRecording": 是否正在录像(true|false),
|
||||||
"serverRecording": 是否正在录像(true|false),
|
"serverRecording": 是否正在录像(true|false),
|
||||||
"lastHeartbeat": "最后心跳时间",
|
"lastHeartbeat" : "最后心跳时间",
|
||||||
"status": {更多状态},
|
"status" : {更多状态},
|
||||||
"config": {更多配置}
|
"config" : {更多配置}
|
||||||
},
|
},
|
||||||
...
|
...
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user