fix: 修正消息发送 API 使用方式

- 使用正确的环信 SDK 4.x 消息创建 API (message.create)
- 修复消息类型参数,使用 'txt' 代替 messageType.TXT
- 测试验证双用户消息互发功能正常工作

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
zyh
2026-03-29 23:19:12 +00:00
parent b3a7461548
commit a01dbdf574

View File

@@ -88,11 +88,11 @@ function createConnection(account, websdk, appConfig) {
// ──────────────────────────────────────────
function sendTextMessage(conn, websdk, to, text, label, stats) {
try {
const message = new websdk.message({
const message = websdk.message.create({
type: 'txt',
to,
type: 'chat',
msg: text,
chatType: 'singleChat',
msg: text,
});
const result = conn.send(message);
// conn.send 可能返回 Promise