docs(node):fix node.js wsconfig case

This commit is contained in:
menshibin 2025-02-11 10:44:49 +08:00
parent d772b95f12
commit a165043d13
1 changed files with 14 additions and 10 deletions

View File

@ -130,6 +130,9 @@ Node.js 连接器(`@tdengine/websocket`, 其通过 taosAdapter 提供的 We
除了通过指定的 URL 获取连接,还可以使用 WSConfig 指定建立连接时的参数。 除了通过指定的 URL 获取连接,还可以使用 WSConfig 指定建立连接时的参数。
```js ```js
const taos = require("@tdengine/websocket");
async function createConnect() {
try { try {
let url = 'ws://127.0.0.1:6041' let url = 'ws://127.0.0.1:6041'
let conf = WsSql.NewConfig(url) let conf = WsSql.NewConfig(url)
@ -137,10 +140,11 @@ try {
conf.setPwd('taosdata') conf.setPwd('taosdata')
conf.setDb('db') conf.setDb('db')
conf.setTimeOut(500) conf.setTimeOut(500)
let wsSql = await WsSql.open(conf); let wsSql = await taos.sqlConnect(conf)
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
}
``` ```
WSConfig 中的配置如下: WSConfig 中的配置如下: