cgserver 12.3.0 → 12.3.2

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # 版本更新日志
2
2
 
3
+ ## v12.3.2
4
+ - get 请求的参数修正
5
+
6
+ ## v12.3.1
7
+ - bugfix
8
+ - serverwebsocket支持wss
9
+
3
10
  ## v12.3.0
4
11
  - 中型版本更新
5
12
  - webserver websocketserver socketserver均取消默认数据库初始化,打算还是剥离
@@ -88,6 +88,7 @@ class RpcConfig {
88
88
  timeout = 0;
89
89
  host = "";
90
90
  port = -1;
91
+ wss = false;
91
92
  }
92
93
  exports.RpcConfig = RpcConfig;
93
94
  class CgMq {
@@ -134,7 +135,7 @@ class CgMq {
134
135
  this._ws = new CgMqServerWebsocket(this);
135
136
  }
136
137
  return new Promise(async (resolve, reject) => {
137
- this._ws.connect(cfg.host, cfg.port);
138
+ this._ws.connect(cfg.wss, cfg.host, cfg.port);
138
139
  let pretime = Date.now();
139
140
  while (true) {
140
141
  if (this._ws.connected) {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Request = void 0;
4
- const url_1 = require("url");
5
4
  const Core_1 = require("../../../Core/Core");
6
5
  const Log_1 = require("../../../Logic/Log");
7
6
  class Request {
@@ -159,10 +158,7 @@ class Request {
159
158
  }
160
159
  let quote_index = path.indexOf("?");
161
160
  if (quote_index >= 0) {
162
- let url = new url_1.URL(path);
163
- url.searchParams.forEach((value, name, searchParams) => {
164
- this._params[name] = value;
165
- });
161
+ this._params = this._req.query || {};
166
162
  path = path.substring(0, quote_index);
167
163
  }
168
164
  let params = path.split("/");
@@ -73,11 +73,16 @@ class IServerWebSocket extends IWebSocket_1.IWebSocket {
73
73
  get extraRequestOptions() {
74
74
  return this._extraRequestOptions;
75
75
  }
76
+ _wss = false;
77
+ get wss() {
78
+ return this._wss;
79
+ }
76
80
  _need_close = false;
77
81
  constructor(protoType = IProtoFilter_1.EProtoType.Json, protoPath = "") {
78
82
  super(protoType, protoPath);
79
83
  }
80
- connect(domain, port, requestedProtocols = null, origin = null, headers = null, extraRequestOptions = null) {
84
+ connect(wss, domain, port, requestedProtocols = null, origin = null, headers = null, extraRequestOptions = null) {
85
+ this._wss = wss;
81
86
  this._host = domain || this._host;
82
87
  this._port = port || this._port;
83
88
  this._requestedProtocols = requestedProtocols || this._requestedProtocols;
@@ -87,7 +92,7 @@ class IServerWebSocket extends IWebSocket_1.IWebSocket {
87
92
  this._connect();
88
93
  }
89
94
  _connect() {
90
- let url = "ws://" + this._host + ":" + this._port + "/";
95
+ let url = (this._wss ? "wss://" : "ws://") + this._host + ":" + this._port + "/";
91
96
  Log_1.gLog.info("Trying to connect to server : " + url);
92
97
  let _ws = new ws.client();
93
98
  _ws.on("connect", this.onConnect.bind(this));
@@ -31,6 +31,7 @@ export declare class RpcConfig {
31
31
  timeout: number;
32
32
  host: string;
33
33
  port: number;
34
+ wss: boolean;
34
35
  }
35
36
  export declare class CgMq {
36
37
  protected _ws: CgMqServerWebsocket;
@@ -25,9 +25,11 @@ export declare class IServerWebSocket extends IWebSocket {
25
25
  get headers(): http.OutgoingHttpHeaders;
26
26
  protected _extraRequestOptions: http.RequestOptions;
27
27
  get extraRequestOptions(): http.RequestOptions;
28
+ protected _wss: boolean;
29
+ get wss(): boolean;
28
30
  protected _need_close: boolean;
29
31
  constructor(protoType?: EProtoType, protoPath?: string);
30
- connect(domain: string, port: number, requestedProtocols?: string | string[], origin?: string, headers?: http.OutgoingHttpHeaders, extraRequestOptions?: http.RequestOptions): void;
32
+ connect(wss: boolean, domain: string, port: number, requestedProtocols?: string | string[], origin?: string, headers?: http.OutgoingHttpHeaders, extraRequestOptions?: http.RequestOptions): void;
31
33
  protected _connect(): void;
32
34
  onOpen(e?: any): void;
33
35
  onClose(reasonCode: number, description: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "12.3.0",
3
+ "version": "12.3.2",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",