cgserver 12.2.7 → 12.3.0
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 +5 -0
- package/dist/lib/Framework/Config/FrameworkConfig.js +1 -1
- package/dist/lib/Framework/Config/IServerConfig.js +0 -1
- package/dist/lib/Framework/Server/SocketServer/ISocketServer.js +8 -6
- package/dist/lib/Framework/Server/WebServer/Engine/Engine.js +4 -6
- package/dist/lib/Framework/Server/WebServer/IWebServer.js +0 -7
- package/dist/lib/Framework/Server/WebSocketServer/IWebSocketServer.js +23 -20
- package/dist/lib/Framework/index_export_.js +3 -1
- package/dist/types/Framework/Config/FrameworkConfig.d.ts +4 -63
- package/dist/types/Framework/Config/IServerConfig.d.ts +0 -1
- package/dist/types/Framework/Server/SocketServer/ISocketServer.d.ts +7 -4
- package/dist/types/Framework/Server/WebSocketServer/IWebSocketServer.d.ts +12 -9
- package/dist/types/Framework/index_export_.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@ exports.gServerCfg = exports.IServerConfig = void 0;
|
|
|
4
4
|
const Log_1 = require("../Logic/Log");
|
|
5
5
|
const FrameworkConfig_1 = require("./FrameworkConfig");
|
|
6
6
|
class IServerConfig extends FrameworkConfig_1.FrameworkConfig {
|
|
7
|
-
port = -1;
|
|
8
7
|
_server_name = "";
|
|
9
8
|
get serverName() {
|
|
10
9
|
return this._server_name;
|
|
@@ -33,11 +33,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ISocketServer = void 0;
|
|
36
|
+
exports.ISocketServer = exports.SocketServerConfig = void 0;
|
|
37
37
|
const cgserver_1 = require("../../cgserver");
|
|
38
38
|
const Log_1 = require("../../Logic/Log");
|
|
39
39
|
const EventTool_1 = require("../../Logic/EventTool");
|
|
40
40
|
const net = __importStar(require("net"));
|
|
41
|
+
class SocketServerConfig {
|
|
42
|
+
port = 0;
|
|
43
|
+
name = "";
|
|
44
|
+
}
|
|
45
|
+
exports.SocketServerConfig = SocketServerConfig;
|
|
41
46
|
class ISocketServer {
|
|
42
47
|
_cfg = null;
|
|
43
48
|
//方便提示
|
|
@@ -50,7 +55,7 @@ class ISocketServer {
|
|
|
50
55
|
return this._is_runging;
|
|
51
56
|
}
|
|
52
57
|
get name() {
|
|
53
|
-
return this._cfg.
|
|
58
|
+
return this._cfg.name;
|
|
54
59
|
}
|
|
55
60
|
//监听websocket
|
|
56
61
|
_server = null;
|
|
@@ -83,9 +88,6 @@ class ISocketServer {
|
|
|
83
88
|
}
|
|
84
89
|
async run() {
|
|
85
90
|
cgserver_1.gCgServer.addSocketServer(this);
|
|
86
|
-
if (this._cfg.db) {
|
|
87
|
-
await cgserver_1.gCgServer.initDb(this._cfg.db);
|
|
88
|
-
}
|
|
89
91
|
this.initSocket();
|
|
90
92
|
}
|
|
91
93
|
pause() {
|
|
@@ -125,7 +127,7 @@ class ISocketServer {
|
|
|
125
127
|
onListenning() {
|
|
126
128
|
this._is_runging = true;
|
|
127
129
|
EventTool_1.gEventTool.emit("socket_server_init_done");
|
|
128
|
-
let info = (new Date()) + "
|
|
130
|
+
let info = (new Date()) + " SocketServer " + this.name + " is listening on port " + this._cfg.port;
|
|
129
131
|
Log_1.gLog.info(info);
|
|
130
132
|
}
|
|
131
133
|
onConnection(socket) {
|
|
@@ -76,12 +76,10 @@ class Engine {
|
|
|
76
76
|
Log_1.gLog.error(this._cfg);
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
if (this._cfg.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
https.createServer(httpsOption, this._app).listen(port, () => {
|
|
79
|
+
if (this._cfg.httpsOption) {
|
|
80
|
+
this._cfg.httpsOption.key = fs.readFileSync(Config_1.Config.rootDataDir + this._cfg.httpsOption.key);
|
|
81
|
+
this._cfg.httpsOption.cert = fs.readFileSync(Config_1.Config.rootDataDir + this._cfg.httpsOption.cert);
|
|
82
|
+
https.createServer(this._cfg.httpsOption, this._app).listen(port, () => {
|
|
85
83
|
this._is_running = true;
|
|
86
84
|
Log_1.gLog.info("Server(" + this._cfg.web_name + ") running at https://127.0.0.1:" + port + "/");
|
|
87
85
|
});
|
|
@@ -6,7 +6,6 @@ const RazorJs_1 = require("./Engine/RazorJs");
|
|
|
6
6
|
const cgserver_1 = require("../../cgserver");
|
|
7
7
|
const EventTool_1 = require("../../Logic/EventTool");
|
|
8
8
|
const Log_1 = require("../../Logic/Log");
|
|
9
|
-
const IServerConfig_1 = require("../../Config/IServerConfig");
|
|
10
9
|
//实现对controller的手动注册
|
|
11
10
|
class IWebServer {
|
|
12
11
|
_engine = null;
|
|
@@ -20,12 +19,6 @@ class IWebServer {
|
|
|
20
19
|
Log_1.gLog.error("webserver 配置不存在,启动服务器失败");
|
|
21
20
|
return false;
|
|
22
21
|
}
|
|
23
|
-
if (!dbcfg && IServerConfig_1.gServerCfg) {
|
|
24
|
-
dbcfg = IServerConfig_1.gServerCfg.db;
|
|
25
|
-
}
|
|
26
|
-
if (dbcfg) {
|
|
27
|
-
await cgserver_1.gCgServer.initDb(dbcfg);
|
|
28
|
-
}
|
|
29
22
|
//初始化web引擎
|
|
30
23
|
this._engine = new Engine_1.Engine(cfg, new RazorJs_1.RazorJs());
|
|
31
24
|
this._engine.start();
|
|
@@ -33,15 +33,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.IWebSocketServer = void 0;
|
|
36
|
+
exports.IWebSocketServer = exports.WebSocketServerConfig = void 0;
|
|
37
37
|
const ws = __importStar(require("websocket"));
|
|
38
38
|
const fs = __importStar(require("fs"));
|
|
39
39
|
const http = __importStar(require("http"));
|
|
40
40
|
const https = __importStar(require("https"));
|
|
41
|
-
const Config_1 = require("../../Config/Config");
|
|
42
41
|
const cgserver_1 = require("../../cgserver");
|
|
43
42
|
const Log_1 = require("../../Logic/Log");
|
|
44
43
|
const EventTool_1 = require("../../Logic/EventTool");
|
|
44
|
+
const Config_1 = require("../../Config/Config");
|
|
45
|
+
class WebSocketServerConfig {
|
|
46
|
+
port = 0;
|
|
47
|
+
accepted_protocol = null;
|
|
48
|
+
name = "";
|
|
49
|
+
ssl_options = null;
|
|
50
|
+
}
|
|
51
|
+
exports.WebSocketServerConfig = WebSocketServerConfig;
|
|
45
52
|
class IWebSocketServer {
|
|
46
53
|
_cfg = null;
|
|
47
54
|
//方便提示
|
|
@@ -54,7 +61,7 @@ class IWebSocketServer {
|
|
|
54
61
|
return this._is_runging;
|
|
55
62
|
}
|
|
56
63
|
get name() {
|
|
57
|
-
return this._cfg.
|
|
64
|
+
return this._cfg.name;
|
|
58
65
|
}
|
|
59
66
|
//监听websocket
|
|
60
67
|
_listening_websocket = null;
|
|
@@ -69,10 +76,6 @@ class IWebSocketServer {
|
|
|
69
76
|
get listenPort() {
|
|
70
77
|
return this._cfg.port;
|
|
71
78
|
}
|
|
72
|
-
/**
|
|
73
|
-
* websocket can accepted protocol
|
|
74
|
-
*/
|
|
75
|
-
_accepted_protocol = null;
|
|
76
79
|
//服务器管理相关
|
|
77
80
|
/*
|
|
78
81
|
item=servername:class
|
|
@@ -93,9 +96,6 @@ class IWebSocketServer {
|
|
|
93
96
|
}
|
|
94
97
|
async run() {
|
|
95
98
|
cgserver_1.gCgServer.addWebSocketServer(this);
|
|
96
|
-
if (this._cfg.db) {
|
|
97
|
-
await cgserver_1.gCgServer.initDb(this._cfg.db);
|
|
98
|
-
}
|
|
99
99
|
this.initWebSocket();
|
|
100
100
|
}
|
|
101
101
|
pause() {
|
|
@@ -128,15 +128,12 @@ class IWebSocketServer {
|
|
|
128
128
|
}
|
|
129
129
|
return true;
|
|
130
130
|
}
|
|
131
|
-
initWebSocket(
|
|
131
|
+
initWebSocket() {
|
|
132
132
|
let server = null;
|
|
133
|
-
if (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
//passphrase:'1234'//如果秘钥文件有密码的话,用这个属性设置密码
|
|
138
|
-
};
|
|
139
|
-
server = https.createServer(options, (request, response) => {
|
|
133
|
+
if (this._cfg.ssl_options) {
|
|
134
|
+
this._cfg.ssl_options.key = fs.readFileSync(Config_1.Config.rootDataDir + this._cfg.ssl_options.key);
|
|
135
|
+
this._cfg.ssl_options.cert = fs.readFileSync(Config_1.Config.rootDataDir + this._cfg.ssl_options.cert);
|
|
136
|
+
server = https.createServer(this._cfg.ssl_options, (request, response) => {
|
|
140
137
|
Log_1.gLog.info((new Date()) + 'wss Received request for ' + request.url);
|
|
141
138
|
response.writeHead(200);
|
|
142
139
|
response.end();
|
|
@@ -167,7 +164,13 @@ class IWebSocketServer {
|
|
|
167
164
|
onListenning() {
|
|
168
165
|
this._is_runging = true;
|
|
169
166
|
EventTool_1.gEventTool.emit("socket_server_init_done");
|
|
170
|
-
let info =
|
|
167
|
+
let info = "";
|
|
168
|
+
if (this._cfg.ssl_options) {
|
|
169
|
+
info = (new Date()) + " wss://" + this.name + ":" + this._cfg.port;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
info = (new Date()) + " ws://" + this.name + ":" + this._cfg.port;
|
|
173
|
+
}
|
|
171
174
|
Log_1.gLog.info(info);
|
|
172
175
|
}
|
|
173
176
|
onRequest(req) {
|
|
@@ -187,7 +190,7 @@ class IWebSocketServer {
|
|
|
187
190
|
return;
|
|
188
191
|
}
|
|
189
192
|
try {
|
|
190
|
-
let conn = req.accept(this.
|
|
193
|
+
let conn = req.accept(this._cfg.accepted_protocol, req.origin);
|
|
191
194
|
if (!conn) {
|
|
192
195
|
Log_1.gLog.error(' protocol reject');
|
|
193
196
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MysqlConfig = exports.MongoConfig = exports.MSSqlConfig = exports.DbConfig = exports.MongoCacheService = exports.MongoCacheModel = exports.MongoUserModel = exports.MysqlUserModel = exports.MongoUserService = exports.MysqlUserService = exports.MongoAccountService = exports.MysqlAccountService = exports.EAccountFrom = exports.EUserState = exports.ERoleGroup = exports.SqlReturns = exports.SqlReturn = exports.MysqlBaseService = exports.MongoExt = exports.MongoManager = exports.MongoBaseModel = exports.MysqlBaseModel = exports.MongoBaseService = exports.EPropertyType = exports.Type = exports.Table = exports.Property = exports.PrimaryKey = exports.NotNull = exports.AutoIncrement = exports.Timer = exports.core = exports.IServerConfig = exports.FrameworkConfig = exports.Config = exports.FrameworkErrorCode = exports.Trigger = exports.Point = exports.Entity = exports.BehaviorAI = exports.AStar = exports.AiObject = exports.MongoServiceManager = exports.CgRankRankData = exports.CgRankRankItem = exports.CgRankCommandItem = exports.CgRankTool = exports.AliSmsConfig = exports.AlipaySdk = exports.EAlipayExecType = void 0;
|
|
4
|
-
exports.global = exports.SyncCallServer2 = exports.SyncCallServer = exports.SyncCall2 = exports.SyncCall = exports.IRpcClientWebSocket = exports.IRpcServerWebSocket = exports.RpcConfig = exports.CgMq = exports.Rpc = exports.RpcBaseMsg = exports.PacketParser = exports.ISocketServer = exports.ISocket = exports.IServerSocket = exports.IClientSocket = exports.EAccountState = exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.JsonCreatorValidate = exports.JsonAuthorityValidate = exports.JsonAdminValidate = exports.CreatorValidate = exports.AuthorityValidate = exports.AdminValidate = exports.MongoAccountModel = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.MysqlBaseUserController = exports.BaseController = exports.IWebServer = exports.BaseMsg = exports.IWebSocket = exports.IWebSocketServer = exports.IClientWebSocket = exports.IServerWebSocket = exports.JsonProtoFilter = exports.GoogleProtoFilter = exports.EProtoType = exports.RedisManager = void 0;
|
|
4
|
+
exports.global = exports.SyncCallServer2 = exports.SyncCallServer = exports.SyncCall2 = exports.SyncCall = exports.IRpcClientWebSocket = exports.IRpcServerWebSocket = exports.RpcConfig = exports.CgMq = exports.Rpc = exports.RpcBaseMsg = exports.PacketParser = exports.SocketServerConfig = exports.ISocketServer = exports.ISocket = exports.IServerSocket = exports.IClientSocket = exports.EAccountState = exports.WebServerConfig = exports.Response = exports.Request = exports.RazorJs = exports.Engine = exports.JsonCreatorValidate = exports.JsonAuthorityValidate = exports.JsonAdminValidate = exports.CreatorValidate = exports.AuthorityValidate = exports.AdminValidate = exports.MongoAccountModel = exports.MysqlAccountModel = exports.MongoBaseUserController = exports.MysqlBaseUserController = exports.BaseController = exports.IWebServer = exports.BaseMsg = exports.IWebSocket = exports.WebSocketServerConfig = exports.IWebSocketServer = exports.IClientWebSocket = exports.IServerWebSocket = exports.JsonProtoFilter = exports.GoogleProtoFilter = exports.EProtoType = exports.RedisManager = void 0;
|
|
5
5
|
var AlipayTool_1 = require("./ThirdParty/AlipayTool");
|
|
6
6
|
Object.defineProperty(exports, "EAlipayExecType", { enumerable: true, get: function () { return AlipayTool_1.EAlipayExecType; } });
|
|
7
7
|
var alipay_sdk_1 = require("alipay-sdk");
|
|
@@ -108,6 +108,7 @@ var IClientWebSocket_1 = require("./Server/WebSocketServer/IClientWebSocket");
|
|
|
108
108
|
Object.defineProperty(exports, "IClientWebSocket", { enumerable: true, get: function () { return IClientWebSocket_1.IClientWebSocket; } });
|
|
109
109
|
var IWebSocketServer_1 = require("./Server/WebSocketServer/IWebSocketServer");
|
|
110
110
|
Object.defineProperty(exports, "IWebSocketServer", { enumerable: true, get: function () { return IWebSocketServer_1.IWebSocketServer; } });
|
|
111
|
+
Object.defineProperty(exports, "WebSocketServerConfig", { enumerable: true, get: function () { return IWebSocketServer_1.WebSocketServerConfig; } });
|
|
111
112
|
var IWebSocket_1 = require("./Server/WebSocketServer/IWebSocket");
|
|
112
113
|
Object.defineProperty(exports, "IWebSocket", { enumerable: true, get: function () { return IWebSocket_1.IWebSocket; } });
|
|
113
114
|
Object.defineProperty(exports, "BaseMsg", { enumerable: true, get: function () { return IWebSocket_1.BaseMsg; } });
|
|
@@ -156,6 +157,7 @@ var ISocket_1 = require("./Server/SocketServer/ISocket");
|
|
|
156
157
|
Object.defineProperty(exports, "ISocket", { enumerable: true, get: function () { return ISocket_1.ISocket; } });
|
|
157
158
|
var ISocketServer_1 = require("./Server/SocketServer/ISocketServer");
|
|
158
159
|
Object.defineProperty(exports, "ISocketServer", { enumerable: true, get: function () { return ISocketServer_1.ISocketServer; } });
|
|
160
|
+
Object.defineProperty(exports, "SocketServerConfig", { enumerable: true, get: function () { return ISocketServer_1.SocketServerConfig; } });
|
|
159
161
|
var PacketParser_1 = require("./Server/SocketServer/PacketParser");
|
|
160
162
|
Object.defineProperty(exports, "PacketParser", { enumerable: true, get: function () { return PacketParser_1.PacketParser; } });
|
|
161
163
|
var IRpc_1 = require("./Server/RpcWebSocketServer/IRpc");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { ServerOptions } from "https";
|
|
1
2
|
import { Config } from "./Config";
|
|
2
3
|
import { DbConfig } from "./DbConfig";
|
|
4
|
+
import * as log4js from "log4js";
|
|
3
5
|
export declare enum ESessionType {
|
|
4
6
|
Cache = 0,
|
|
5
7
|
Redis = 1,
|
|
@@ -29,10 +31,7 @@ export declare class WebServerConfig {
|
|
|
29
31
|
action: string;
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
|
-
|
|
33
|
-
key: string;
|
|
34
|
-
crt: string;
|
|
35
|
-
};
|
|
34
|
+
httpsOption: ServerOptions<any, any>;
|
|
36
35
|
cors: {
|
|
37
36
|
origin: string | string[];
|
|
38
37
|
methods: string | string[];
|
|
@@ -72,65 +71,7 @@ declare class WechatConfig {
|
|
|
72
71
|
redirect_uri: string;
|
|
73
72
|
}
|
|
74
73
|
export declare class FrameworkConfig extends Config {
|
|
75
|
-
log:
|
|
76
|
-
appenders: {
|
|
77
|
-
console: {
|
|
78
|
-
type: string;
|
|
79
|
-
category: string;
|
|
80
|
-
};
|
|
81
|
-
log_file: {
|
|
82
|
-
category: string;
|
|
83
|
-
type: string;
|
|
84
|
-
filename: string;
|
|
85
|
-
maxLogSize: number;
|
|
86
|
-
backups: number;
|
|
87
|
-
};
|
|
88
|
-
log_date: {
|
|
89
|
-
category: string;
|
|
90
|
-
type: string;
|
|
91
|
-
filename: string;
|
|
92
|
-
alwaysIncludePattern: boolean;
|
|
93
|
-
pattern: string;
|
|
94
|
-
numBackups: number;
|
|
95
|
-
};
|
|
96
|
-
client_log_file: {
|
|
97
|
-
category: string;
|
|
98
|
-
type: string;
|
|
99
|
-
filename: string;
|
|
100
|
-
maxLogSize: number;
|
|
101
|
-
backups: number;
|
|
102
|
-
};
|
|
103
|
-
client_log_date: {
|
|
104
|
-
category: string;
|
|
105
|
-
type: string;
|
|
106
|
-
filename: string;
|
|
107
|
-
alwaysIncludePattern: boolean;
|
|
108
|
-
pattern: string;
|
|
109
|
-
numBackups: number;
|
|
110
|
-
};
|
|
111
|
-
error_log_file: {
|
|
112
|
-
category: string;
|
|
113
|
-
type: string;
|
|
114
|
-
filename: string;
|
|
115
|
-
maxLogSize: number;
|
|
116
|
-
backups: number;
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
categories: {
|
|
120
|
-
default: {
|
|
121
|
-
appenders: string[];
|
|
122
|
-
level: string;
|
|
123
|
-
};
|
|
124
|
-
client_logger: {
|
|
125
|
-
appenders: string[];
|
|
126
|
-
level: string;
|
|
127
|
-
};
|
|
128
|
-
error_logger: {
|
|
129
|
-
appenders: string[];
|
|
130
|
-
level: string;
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
};
|
|
74
|
+
log: log4js.Configuration;
|
|
134
75
|
db: DbConfig;
|
|
135
76
|
qiniu: QiNiuConfig;
|
|
136
77
|
email: EmailConfig;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { IServerConfig } from '../../Config/IServerConfig';
|
|
2
1
|
import { BaseMsg } from './ISocket';
|
|
3
2
|
import * as net from 'net';
|
|
4
3
|
import { IClientSocket } from './IClientSocket';
|
|
4
|
+
export declare class SocketServerConfig {
|
|
5
|
+
port: number;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
5
8
|
export declare class ISocketServer {
|
|
6
|
-
protected _cfg:
|
|
7
|
-
get cfg():
|
|
9
|
+
protected _cfg: SocketServerConfig;
|
|
10
|
+
get cfg(): SocketServerConfig;
|
|
8
11
|
protected _is_runging: boolean;
|
|
9
12
|
get isrunging(): boolean;
|
|
10
13
|
get name(): string;
|
|
@@ -20,7 +23,7 @@ export declare class ISocketServer {
|
|
|
20
23
|
protected _accepted_protocol: any;
|
|
21
24
|
protected _cls: any;
|
|
22
25
|
registerSocketHandleClass(cls: any): void;
|
|
23
|
-
constructor(cfg:
|
|
26
|
+
constructor(cfg: SocketServerConfig);
|
|
24
27
|
removeServerSocketBySocketId(socketId: number): void;
|
|
25
28
|
run(): Promise<void>;
|
|
26
29
|
pause(): void;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import * as ws from 'websocket';
|
|
2
|
-
import
|
|
2
|
+
import * as http from "http";
|
|
3
|
+
import * as https from "https";
|
|
3
4
|
import { BaseMsg } from './IWebSocket';
|
|
4
5
|
import { IClientWebSocket } from './IClientWebSocket';
|
|
6
|
+
export declare class WebSocketServerConfig {
|
|
7
|
+
port: number;
|
|
8
|
+
accepted_protocol: string | null;
|
|
9
|
+
name: string;
|
|
10
|
+
ssl_options?: https.ServerOptions<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
11
|
+
}
|
|
5
12
|
export declare class IWebSocketServer {
|
|
6
|
-
protected _cfg:
|
|
7
|
-
get cfg():
|
|
13
|
+
protected _cfg: WebSocketServerConfig;
|
|
14
|
+
get cfg(): WebSocketServerConfig;
|
|
8
15
|
protected _is_runging: boolean;
|
|
9
16
|
get isrunging(): boolean;
|
|
10
17
|
get name(): string;
|
|
@@ -17,20 +24,16 @@ export declare class IWebSocketServer {
|
|
|
17
24
|
[socketid: number]: IClientWebSocket;
|
|
18
25
|
};
|
|
19
26
|
get listenPort(): number;
|
|
20
|
-
/**
|
|
21
|
-
* websocket can accepted protocol
|
|
22
|
-
*/
|
|
23
|
-
protected _accepted_protocol: any;
|
|
24
27
|
protected _name_vs_class: {};
|
|
25
28
|
registerWebSocketHandleClass(name: string, cls: any): void;
|
|
26
|
-
constructor(cfg:
|
|
29
|
+
constructor(cfg: WebSocketServerConfig);
|
|
27
30
|
removeServerWebSocketBySocketId(socketId: number): void;
|
|
28
31
|
run(): Promise<void>;
|
|
29
32
|
pause(): void;
|
|
30
33
|
resume(): void;
|
|
31
34
|
addClient(ws_client: IClientWebSocket): void;
|
|
32
35
|
isOriginAllowed(origin: any): boolean;
|
|
33
|
-
initWebSocket(
|
|
36
|
+
initWebSocket(): void;
|
|
34
37
|
onClose(connection: ws.connection, reason: number, desc: string): void;
|
|
35
38
|
onListenning(): void;
|
|
36
39
|
onRequest(req: ws.request): void;
|
|
@@ -46,7 +46,7 @@ export { IProtoFilter } from './Server/ProtoFilter/IProtoFilter';
|
|
|
46
46
|
export { JsonProtoFilter } from './Server/ProtoFilter/JsonProtoFilter';
|
|
47
47
|
export { IServerWebSocket } from './Server/WebSocketServer/IServerWebSocket';
|
|
48
48
|
export { IClientWebSocket } from './Server/WebSocketServer/IClientWebSocket';
|
|
49
|
-
export { IWebSocketServer } from './Server/WebSocketServer/IWebSocketServer';
|
|
49
|
+
export { IWebSocketServer, WebSocketServerConfig } from './Server/WebSocketServer/IWebSocketServer';
|
|
50
50
|
export { IWebSocket, BaseMsg } from './Server/WebSocketServer/IWebSocket';
|
|
51
51
|
export { IWebServer } from './Server/WebServer/IWebServer';
|
|
52
52
|
export { BaseController } from './Server/WebServer/Controller/BaseController';
|
|
@@ -69,7 +69,7 @@ export { EAccountState } from './Service/ini';
|
|
|
69
69
|
export { IClientSocket } from './Server/SocketServer/IClientSocket';
|
|
70
70
|
export { IServerSocket } from './Server/SocketServer/IServerSocket';
|
|
71
71
|
export { ISocket } from './Server/SocketServer/ISocket';
|
|
72
|
-
export { ISocketServer } from './Server/SocketServer/ISocketServer';
|
|
72
|
+
export { ISocketServer, SocketServerConfig } from './Server/SocketServer/ISocketServer';
|
|
73
73
|
export { PacketParser } from './Server/SocketServer/PacketParser';
|
|
74
74
|
export { RpcMsg as RpcBaseMsg } from './Server/RpcWebSocketServer/IRpc';
|
|
75
75
|
export { Rpc } from './ThirdParty/Rpc';
|