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/browser.js
CHANGED
|
@@ -2323,8 +2323,6 @@ class DDB {
|
|
|
2323
2323
|
try {
|
|
2324
2324
|
assert(this.connected);
|
|
2325
2325
|
await this.rpc('connect', { skip_connection_check: true });
|
|
2326
|
-
if (this.autologin)
|
|
2327
|
-
await this.call('login', [this.username, this.password], { urgent: true, skip_connection_check: true });
|
|
2328
2326
|
if (this.streaming)
|
|
2329
2327
|
await this.subscribe();
|
|
2330
2328
|
resolve();
|
|
@@ -2367,9 +2365,13 @@ class DDB {
|
|
|
2367
2365
|
return options.join('_');
|
|
2368
2366
|
}
|
|
2369
2367
|
disconnect() {
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2368
|
+
const { resource } = this.lwebsocket;
|
|
2369
|
+
if (resource) {
|
|
2370
|
+
const { readyState } = resource;
|
|
2371
|
+
if (readyState !== WebSocket.CLOSED && readyState !== WebSocket.CLOSING)
|
|
2372
|
+
// 这里不获取 lock,直接关闭连接
|
|
2373
|
+
resource.close(1000);
|
|
2374
|
+
}
|
|
2373
2375
|
}
|
|
2374
2376
|
/** (内部使用的方法) rpc through websocket (function/script/variable command)
|
|
2375
2377
|
未连接到 DDB 时调用会自动连接,连接断开时调用会抛出 DdbConnectionError
|
|
@@ -2502,8 +2504,21 @@ class DDB {
|
|
|
2502
2504
|
`${Number(DDB.le_client)}\n`;
|
|
2503
2505
|
case 'connect':
|
|
2504
2506
|
if (this.verbose)
|
|
2505
|
-
console.log('connect()'
|
|
2506
|
-
|
|
2507
|
+
console.log('connect()' +
|
|
2508
|
+
(this.autologin ?
|
|
2509
|
+
'\n' +
|
|
2510
|
+
`login(${this.username.quote()}, ${this.password.quote()})`
|
|
2511
|
+
:
|
|
2512
|
+
''));
|
|
2513
|
+
return 'connect\n' +
|
|
2514
|
+
// 详见 InterProcessIO.cpp#APISocketConsole::parseScript 中的
|
|
2515
|
+
// Util::startWith "connect"
|
|
2516
|
+
(this.autologin ?
|
|
2517
|
+
'login\n' +
|
|
2518
|
+
this.username + '\n' +
|
|
2519
|
+
this.password /* encrypted (可选参数) + '\n' + 'false' */
|
|
2520
|
+
:
|
|
2521
|
+
'');
|
|
2507
2522
|
}
|
|
2508
2523
|
})());
|
|
2509
2524
|
websocket.send(concat([
|