From 1322ff28c116a48b6186a6f5f94f6cb4f5d6cb1b Mon Sep 17 00:00:00 2001 From: crlfe Date: Mon, 24 Jun 2024 19:18:50 +0800 Subject: [PATCH] Update websocket.md --- docs/websocket.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/websocket.md b/docs/websocket.md index 9737077..53f9dfe 100644 --- a/docs/websocket.md +++ b/docs/websocket.md @@ -166,7 +166,7 @@ await uniCloud.ws.send(connectionId, sendData) |参数|类型|说明| |---|---|---| |connectionId|`String` `Array`|客户端连接ID, 支持批量向客户端发送消息| -|sendData|`String` `Object` `Buffer`|发送给客户端的消息内容| +|sendData|`String` `Buffer`|发送给客户端的消息内容| **示例** @@ -182,7 +182,7 @@ exports.onWebsocketMessage = async function (event) { // 发送给多个客户端 await uniCloud.ws.send([connectionId1, connectionId2, ...], `receive:${payload}`) - // 发送给客户端对象数据 + // 发送给客户端对象数据,发送时会自动JSON.stringify await uniCloud.ws.send(connectionId, { receive: payload }) @@ -307,4 +307,4 @@ exampleWebSocket.onError(event => { console.log("WebSocket:error", event) }) -``` \ No newline at end of file +``` -- GitLab