ee-core 1.1.9 → 1.1.10

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.
@@ -194,7 +194,16 @@ module.exports = appInfo => {
194
194
  /* 内置socket服务 */
195
195
  config.socketServer = {
196
196
  port: 7070, // 默认端口
197
- isDynamic: false // 如果值为false,框架默认使用port端口(如果默认端口被使用,则随机获取一个);如果为true,默认端口无效,框架随机生成
197
+ isDynamic: false, // 如果值为false,框架默认使用port端口(如果默认端口被使用,则随机获取一个);如果为true,默认端口无效,框架随机生成
198
+ path: "/socket.io/", // 路径名称
199
+ connectTimeout: 45000, // 客户端连接超时时间
200
+ pingTimeout: 30000, // 心跳检测超时时间
201
+ pingInterval: 25000, // 心跳检测间隔
202
+ maxHttpBufferSize: 1e8, // 每条消息的数据大小 1M
203
+ transports: ["polling", "websocket"], // http轮询和websocket
204
+ cors: {
205
+ origin: true, // http协议时,要设置跨域 类型 Boolean String RegExp Array Function
206
+ }
198
207
  };
199
208
 
200
209
  return config;
@@ -18,7 +18,8 @@ class SocketServer {
18
18
  this.app = app;
19
19
  this.consoleLogger = new EggConsoleLogger();
20
20
  this.consoleLogger.info('[ee-core:socket:server] start server, socket port is:', port);
21
- this.io = new Server(port);
21
+ const options = this.app.config.socketServer;
22
+ this.io = new Server(port, options);
22
23
  this.connec();
23
24
  }
24
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ee-core",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "description": "ee core",
5
5
  "main": "index.js",
6
6
  "scripts": {