cgserver 9.1.13 → 9.1.14
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/README.md +2 -0
- package/dist/lib/Framework/Logic/HttpTool.js +4 -0
- package/dist/lib/Framework/SocketServer/IRpcClientWebSocket.js +2 -2
- package/dist/lib/Framework/SocketServer/IWebSocket.js +4 -0
- package/dist/lib/Framework/ThirdParty/CgMq.js +4 -0
- package/dist/lib/Framework/WebServer/Engine/Response.js +0 -2
- package/dist/types/Framework/WebServer/Engine/Response.d.ts +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ class HttpTool {
|
|
|
15
15
|
this._debug = value;
|
|
16
16
|
}
|
|
17
17
|
get(options_url) {
|
|
18
|
+
let time = Date.now();
|
|
18
19
|
let options = null;
|
|
19
20
|
if (Core_1.core.isString(options_url)) {
|
|
20
21
|
options = { url: options_url };
|
|
@@ -47,6 +48,7 @@ class HttpTool {
|
|
|
47
48
|
}
|
|
48
49
|
if (this._debug) {
|
|
49
50
|
Log_1.GLog.info({
|
|
51
|
+
dttime: (Date.now() - time) + "ms",
|
|
50
52
|
url: options.url,
|
|
51
53
|
originbody: originbody
|
|
52
54
|
});
|
|
@@ -56,6 +58,7 @@ class HttpTool {
|
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
post(options_url) {
|
|
61
|
+
let time = Date.now();
|
|
59
62
|
let options = null;
|
|
60
63
|
if (Core_1.core.isString(options_url)) {
|
|
61
64
|
options = { url: options_url };
|
|
@@ -88,6 +91,7 @@ class HttpTool {
|
|
|
88
91
|
}
|
|
89
92
|
if (this._debug) {
|
|
90
93
|
Log_1.GLog.info({
|
|
94
|
+
dttime: (Date.now() - time) + "ms",
|
|
91
95
|
url: options.url,
|
|
92
96
|
originbody: originbody
|
|
93
97
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IRpcClientWebSocket = void 0;
|
|
4
|
-
const _ = require("underscore");
|
|
5
4
|
const EventTool_1 = require("../Logic/EventTool");
|
|
6
5
|
const Log_1 = require("../Logic/Log");
|
|
7
6
|
const IClientWebSocket_1 = require("./IClientWebSocket");
|
|
7
|
+
const Core_1 = require("../Core/Core");
|
|
8
8
|
class IRpcClientWebSocket extends IClientWebSocket_1.IClientWebSocket {
|
|
9
9
|
/**
|
|
10
10
|
* 自己的身份
|
|
@@ -14,7 +14,7 @@ class IRpcClientWebSocket extends IClientWebSocket_1.IClientWebSocket {
|
|
|
14
14
|
//超时时间
|
|
15
15
|
_timeout = 3000;
|
|
16
16
|
_genId(pre = "") {
|
|
17
|
-
return pre + "_" +
|
|
17
|
+
return pre + "_" + Core_1.core.getUuid();
|
|
18
18
|
}
|
|
19
19
|
getNewMsg(cmd, errcode) {
|
|
20
20
|
let msg = super.getNewMsg(cmd, errcode);
|
|
@@ -139,6 +139,7 @@ class IWebSocket {
|
|
|
139
139
|
return true;
|
|
140
140
|
}
|
|
141
141
|
async _onMessage(data) {
|
|
142
|
+
let time = Date.now();
|
|
142
143
|
let jsonData = data;
|
|
143
144
|
let func = this["receive_" + jsonData.cmd];
|
|
144
145
|
let ret = this.filterMsg(jsonData);
|
|
@@ -157,6 +158,9 @@ class IWebSocket {
|
|
|
157
158
|
else {
|
|
158
159
|
await Core_1.core.safeCall(func, this, jsonData);
|
|
159
160
|
}
|
|
161
|
+
if (this._debug_msg) {
|
|
162
|
+
Log_1.GLog.info("[" + (Date.now() - time) + "ms] " + jsonData.cmd);
|
|
163
|
+
}
|
|
160
164
|
}
|
|
161
165
|
onOpen(e) {
|
|
162
166
|
}
|
|
@@ -105,11 +105,15 @@ class CgMq {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
async callRemote(group, to_id, func_name, ...args) {
|
|
108
|
+
let time = Date.now();
|
|
108
109
|
let data = {
|
|
109
110
|
cmd: func_name,
|
|
110
111
|
args: args
|
|
111
112
|
};
|
|
112
113
|
let ret_rpcmsg = await this._ws.push(group, data, to_id);
|
|
114
|
+
if (this._ws.debug_msg) {
|
|
115
|
+
Log_1.GLog.info("[" + (Date.now() - time) + "ms] callRemote:" + group + "-" + func_name);
|
|
116
|
+
}
|
|
113
117
|
return ret_rpcmsg;
|
|
114
118
|
}
|
|
115
119
|
async onMsg(msg) {
|
|
@@ -8,12 +8,10 @@ class Response {
|
|
|
8
8
|
_res = null;
|
|
9
9
|
_cookie_prefix = "";
|
|
10
10
|
_cfg = null;
|
|
11
|
-
_create_time = -1;
|
|
12
11
|
get baseRes() {
|
|
13
12
|
return this._res;
|
|
14
13
|
}
|
|
15
14
|
constructor(res, cfg) {
|
|
16
|
-
this._create_time = Date.now();
|
|
17
15
|
this._cfg = cfg;
|
|
18
16
|
this._res = res;
|
|
19
17
|
this._cookie_prefix = this._cfg.cookie.prefix;
|
|
@@ -4,7 +4,6 @@ export declare class Response {
|
|
|
4
4
|
protected _res: Express.Response;
|
|
5
5
|
protected _cookie_prefix: string;
|
|
6
6
|
protected _cfg: WebServerConfig;
|
|
7
|
-
protected _create_time: number;
|
|
8
7
|
get baseRes(): Express.Response<any, Record<string, any>>;
|
|
9
8
|
constructor(res: Express.Response, cfg: WebServerConfig);
|
|
10
9
|
/**
|