Appearance
ACP消息格式
主要的消息收发角色
Agent
AP
心跳服务
会话服务
存储服务
流式服务
证书服务
消息发送链路
Agent->AP,心跳,会话,存储,流式
AP->响应Agent,浏览器,
心跳->响应会话服务,响应Agent
会话->主动和响应Agent,心跳
存储->响应Agent
流式->响应Agent
消息格式定义
Agent与AP之间的所有消息均使用https传输,json格式。
Agent发送给AP的消息定义:
plain text
{
"agent_id": "xxx.yyy.zzz",
"signature": "xxxxxxxxxx",
....
}
1
2
3
4
5
2
3
4
5
AP响应Agent的消息定义:
plain text
{
"code": 200,
"message": "OK"
...
}
1
2
3
4
5
2
3
4
5
错误代码定义:
plain text
2XX
200 成功处理消息,直接回复了数据
201 回复了一个流式输出端口,数据需要从端口中获取或者推送
202 已经开始处理,需要等待后续的消息
4XX
401 请求者AID不在授权范围内(在agentprofile的)
403 问题超出服务范围
5XX
503 当前请求超过服务能力
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Agent与消息服务之间的通信,wss传输的下列二进制格式:
plain text
MessageHeader 消息头
MessageBody 消息体
1
2
2
plain text
MessageHeader 定义:
MagicNumber MU 2字节
Version 版本号 2字节
Flags 标志位 4字节
MsgType 消息类型 2字节
MsgSeq 消息序列号 4字节
ContentType 内容类型 1字节
EncodedFlag 编码标志 1字节
Reserved 保留 4字节
CRC32 消息负载CRC32 4字节
PayloadLength 消息负载长度 4字节
ContentType:
0: 普通文本
1: json文本
2: audio data
3: video data
4: image
5:
EncodedFlag:
7 6 5 4 3 2 1 0
第0位:压缩标志
第1位: 加密标志
0: 原始内容
1. zip压缩
2. 加密
3. zip压缩+加密
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28