2025-09-15 18:56:11 +08:00
|
|
|
|
package transport
|
|
|
|
|
|
|
2025-09-15 18:57:47 +08:00
|
|
|
|
// Communicator 用于其他设备通信
|
|
|
|
|
|
type Communicator interface {
|
2025-09-15 21:27:54 +08:00
|
|
|
|
// Send 用于发送一条单向数据(不等待回信)
|
2025-09-26 22:50:08 +08:00
|
|
|
|
// 成功时,它返回一个包含 MessageID 的 SendResult,以便调用方追踪。
|
|
|
|
|
|
Send(address string, payload []byte) (*SendResult, error)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SendResult 包含了 SendGo 方法成功执行后返回的结果。
|
|
|
|
|
|
type SendResult struct {
|
|
|
|
|
|
// MessageID 是通信服务为此次发送分配的唯一标识符。
|
|
|
|
|
|
// 调用方需要保存此 ID,以便后续关联 ACK 等事件。
|
|
|
|
|
|
MessageID string
|
2025-09-15 18:56:11 +08:00
|
|
|
|
}
|