dolphindb 2.0.956 → 2.0.958
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.js +22 -7
- package/browser.js.map +1 -1
- package/index.js +22 -7
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2313,8 +2313,6 @@ class DDB {
|
|
|
2313
2313
|
try {
|
|
2314
2314
|
assert(this.connected);
|
|
2315
2315
|
await this.rpc('connect', { skip_connection_check: true });
|
|
2316
|
-
if (this.autologin)
|
|
2317
|
-
await this.call('login', [this.username, this.password], { urgent: true, skip_connection_check: true });
|
|
2318
2316
|
if (this.streaming)
|
|
2319
2317
|
await this.subscribe();
|
|
2320
2318
|
resolve();
|
|
@@ -2357,9 +2355,13 @@ class DDB {
|
|
|
2357
2355
|
return options.join('_');
|
|
2358
2356
|
}
|
|
2359
2357
|
disconnect() {
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2358
|
+
const { resource } = this.lwebsocket;
|
|
2359
|
+
if (resource) {
|
|
2360
|
+
const { readyState } = resource;
|
|
2361
|
+
if (readyState !== WebSocket.CLOSED && readyState !== WebSocket.CLOSING)
|
|
2362
|
+
// 这里不获取 lock,直接关闭连接
|
|
2363
|
+
resource.close(1000);
|
|
2364
|
+
}
|
|
2363
2365
|
}
|
|
2364
2366
|
/** (内部使用的方法) rpc through websocket (function/script/variable command)
|
|
2365
2367
|
未连接到 DDB 时调用会自动连接,连接断开时调用会抛出 DdbConnectionError
|
|
@@ -2492,8 +2494,21 @@ class DDB {
|
|
|
2492
2494
|
`${Number(DDB.le_client)}\n`;
|
|
2493
2495
|
case 'connect':
|
|
2494
2496
|
if (this.verbose)
|
|
2495
|
-
console.log('connect()'
|
|
2496
|
-
|
|
2497
|
+
console.log('connect()' +
|
|
2498
|
+
(this.autologin ?
|
|
2499
|
+
'\n' +
|
|
2500
|
+
`login(${this.username.quote()}, ${this.password.quote()})`
|
|
2501
|
+
:
|
|
2502
|
+
''));
|
|
2503
|
+
return 'connect\n' +
|
|
2504
|
+
// 详见 InterProcessIO.cpp#APISocketConsole::parseScript 中的
|
|
2505
|
+
// Util::startWith "connect"
|
|
2506
|
+
(this.autologin ?
|
|
2507
|
+
'login\n' +
|
|
2508
|
+
this.username + '\n' +
|
|
2509
|
+
this.password /* encrypted (可选参数) + '\n' + 'false' */
|
|
2510
|
+
:
|
|
2511
|
+
'');
|
|
2497
2512
|
}
|
|
2498
2513
|
})());
|
|
2499
2514
|
websocket.send(concat([
|