【m】远端视频开发
This commit is contained in:
@@ -60,7 +60,7 @@ function reset(mode: string): void {
|
||||
*/
|
||||
function add(ws: WebSocket): void {
|
||||
// 为新连接创建空的连接ID集合
|
||||
var id = new Set<string>();
|
||||
const id = new Set<string>();
|
||||
clients.set(ws, id);
|
||||
// 记录添加WebSocket连接的日志
|
||||
console.log(`Add WebSocket: ${id}`);
|
||||
@@ -347,7 +347,22 @@ function onCandidate(ws: WebSocket, message: any): void {
|
||||
clearInterval((ws as any).heartbeatTimer);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 处理获取所有连接ID的请求
|
||||
* @param ws WebSocket连接实例
|
||||
*/
|
||||
function onGetAllConnectionIds(): string[] {
|
||||
// 获取所有connectionId
|
||||
const connectionIds = Array.from(connectionPair.keys());
|
||||
// 发送连接ID列表给客户端
|
||||
// ws.send(JSON.stringify({
|
||||
// type: "connection-ids",
|
||||
// connectionIds: connectionIds
|
||||
// }));
|
||||
return connectionIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出WebSocket处理器函数
|
||||
*/
|
||||
export { reset, add, remove, onConnect, onDisconnect, onOffer, onAnswer, onCandidate,onCallConnectionId, onBroadcast, AddHeartbeat, RemoveHeartbeat };
|
||||
export { reset, add, remove, onConnect, onDisconnect, onOffer, onAnswer, onCandidate, onCallConnectionId, onBroadcast, onGetAllConnectionIds, AddHeartbeat, RemoveHeartbeat };
|
||||
|
||||
Reference in New Issue
Block a user