[*] readme

This commit is contained in:
acgist
2022-11-20 08:47:29 +08:00
parent 3663d63458
commit a08449cb8b
4 changed files with 32 additions and 5 deletions

View File

@@ -96,7 +96,7 @@ taoyao:
security: security:
enabled: true enabled: true
realm: taoyao realm: taoyao
permit: /v3/api-docs/,/swagger-ui/,/favicon.ico,/error permit: /v3/api-docs/,/swagger-ui/,/swagger-ui.html,/favicon.ico,/error
username: taoyao username: taoyao
password: taoyao password: taoyao
scheduled: scheduled:

View File

@@ -18,16 +18,29 @@
} }
``` ```
### 符号解释
```
-> 单播:定向传播信令
-) 广播:广播信令(排除自己)
+) 全员广播:广播信令(包含自己)
```
## 平台信令1000~1999 ## 平台信令1000~1999
### 关闭服务信令1000 ### 关闭服务信令1000
终端->服务端:关闭信令服务 #### 消息主体
``` ```
{} {}
``` ```
#### 消息流程:终端->服务端+)终端
* 全员广播关闭服务信令
* 关闭信令服务
### 执行命令信令1001 ### 执行命令信令1001
终端->服务端:执行系统命令 终端->服务端:执行系统命令
@@ -61,7 +74,7 @@
### 终端注册信令2000 ### 终端注册信令2000
终端->服务端:注册成功后服务端响应,同时下发配置信息,广播终端上线事件。 终端->服务端-)终端:注册成功后服务端响应,同时下发配置信息,广播终端上线事件。
``` ```
{ {
@@ -260,3 +273,11 @@ MCU/SFU模式有效
### Offer ### Offer
### Answer ### Answer
## 测试
```
let socket = new WebSocket("wss://localhost:8888/websocket.signal");
socket.send('{"header":{"pid":2000,"v":"1.0.0","id":"1","sn":"taoyao"},"body":{"username":"taoyao","password":"taoyao"}}');
socket.send('{"header":{"pid":1000,"v":"1.0.0","id":"1","sn":"taoyao"},"body":{}}');
```

View File

@@ -9,6 +9,7 @@ import com.acgist.taoyao.boot.model.Header;
import com.acgist.taoyao.boot.model.Message; import com.acgist.taoyao.boot.model.Message;
import com.acgist.taoyao.boot.model.MessageCode; import com.acgist.taoyao.boot.model.MessageCode;
import com.acgist.taoyao.boot.service.IdService; import com.acgist.taoyao.boot.service.IdService;
import com.acgist.taoyao.signal.client.ClientSessionManager;
import com.acgist.taoyao.signal.event.ApplicationEventAdapter; import com.acgist.taoyao.signal.event.ApplicationEventAdapter;
/** /**
@@ -24,6 +25,8 @@ public abstract class ProtocolAdapter implements Protocol {
protected ApplicationContext context; protected ApplicationContext context;
@Autowired @Autowired
protected TaoyaoProperties taoyaoProperties; protected TaoyaoProperties taoyaoProperties;
@Autowired
protected ClientSessionManager clientSessionManager;
/** /**
* 信令标识 * 信令标识

View File

@@ -26,8 +26,11 @@ public class ShutdownProtocol extends ProtocolAdapter {
@Override @Override
public void execute(String sn, Message message, ClientSession session) { public void execute(String sn, Message message, ClientSession session) {
// 全员广播
this.clientSessionManager.broadcast(message);
// 关闭信令服务
if(this.context instanceof ConfigurableApplicationContext context) { if(this.context instanceof ConfigurableApplicationContext context) {
log.info("关闭服务:{}", sn); log.info("关闭信令服务:{}", sn);
if(context.isActive()) { if(context.isActive()) {
context.close(); context.close();
} }