@midwayjs/socketio 3.0.0-alpha.10 → 3.0.0-alpha.37
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/CHANGELOG.md +1 -9
- package/dist/framework.js +5 -5
- package/dist/util.js +2 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,15 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @midwayjs/socketio
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [3.0.0-alpha.1](https://github.com/midwayjs/midway/compare/v2.12.1...v3.0.0-alpha.1) (2021-08-04)
|
|
6
|
+
## [2.12.3](https://github.com/midwayjs/midway/compare/v2.12.2...v2.12.3) (2021-08-09)
|
|
15
7
|
|
|
16
8
|
**Note:** Version bump only for package @midwayjs/socketio
|
|
17
9
|
|
package/dist/framework.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MidwaySocketIOFramework = void 0;
|
|
4
4
|
const core_1 = require("@midwayjs/core");
|
|
5
5
|
const util_1 = require("util");
|
|
6
|
-
const debug = util_1.debuglog('midway:socket.io');
|
|
6
|
+
const debug = (0, util_1.debuglog)('midway:socket.io');
|
|
7
7
|
const socket_io_1 = require("socket.io");
|
|
8
8
|
const decorator_1 = require("@midwayjs/decorator");
|
|
9
9
|
const logger_1 = require("./logger");
|
|
@@ -47,16 +47,16 @@ class MidwaySocketIOFramework extends core_1.BaseFramework {
|
|
|
47
47
|
}
|
|
48
48
|
async loadMidwayController() {
|
|
49
49
|
// create room
|
|
50
|
-
const controllerModules =
|
|
50
|
+
const controllerModules = (0, decorator_1.listModule)(decorator_1.WS_CONTROLLER_KEY);
|
|
51
51
|
for (const module of controllerModules) {
|
|
52
|
-
const providerId =
|
|
52
|
+
const providerId = (0, decorator_1.getProviderId)(module);
|
|
53
53
|
if (providerId) {
|
|
54
54
|
await this.addNamespace(module, providerId);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
async addNamespace(target, controllerId) {
|
|
59
|
-
const controllerOption =
|
|
59
|
+
const controllerOption = (0, decorator_1.getClassMetadata)(decorator_1.WS_CONTROLLER_KEY, target);
|
|
60
60
|
const nsp = this.app.of(controllerOption.namespace);
|
|
61
61
|
this.namespaceList.push(controllerOption.namespace);
|
|
62
62
|
nsp.use((socket, next) => {
|
|
@@ -66,7 +66,7 @@ class MidwaySocketIOFramework extends core_1.BaseFramework {
|
|
|
66
66
|
next();
|
|
67
67
|
});
|
|
68
68
|
nsp.on('connect', async (socket) => {
|
|
69
|
-
const wsEventInfos =
|
|
69
|
+
const wsEventInfos = (0, decorator_1.getClassMetadata)(decorator_1.WS_EVENT_KEY, target);
|
|
70
70
|
// 存储方法对应的响应处理
|
|
71
71
|
const methodMap = {};
|
|
72
72
|
if (wsEventInfos.length) {
|
package/dist/util.js
CHANGED
|
@@ -4,10 +4,10 @@ exports.createRedisAdapter = void 0;
|
|
|
4
4
|
const socket_io_redis_1 = require("socket.io-redis");
|
|
5
5
|
function createRedisAdapter(options) {
|
|
6
6
|
if (options.host && options.port) {
|
|
7
|
-
return socket_io_redis_1.createAdapter('redis://' + options.host + ':' + options.port, options);
|
|
7
|
+
return (0, socket_io_redis_1.createAdapter)('redis://' + options.host + ':' + options.port, options);
|
|
8
8
|
}
|
|
9
9
|
if (options.pubClient && options.subClient) {
|
|
10
|
-
return socket_io_redis_1.createAdapter(options);
|
|
10
|
+
return (0, socket_io_redis_1.createAdapter)(options);
|
|
11
11
|
}
|
|
12
12
|
throw new Error('error socket adapter options');
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/socketio",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.37+574e016e",
|
|
4
4
|
"description": "Midway Web Framework for socket.io",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
],
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@midwayjs/decorator": "^3.0.0-alpha.
|
|
27
|
-
"@midwayjs/mock": "^3.0.0-alpha.
|
|
26
|
+
"@midwayjs/decorator": "^3.0.0-alpha.37+574e016e",
|
|
27
|
+
"@midwayjs/mock": "^3.0.0-alpha.37+574e016e",
|
|
28
28
|
"@types/socket.io-client": "^1.4.36",
|
|
29
29
|
"fs-extra": "^8.0.1",
|
|
30
30
|
"socket.io-client": "^4.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@midwayjs/core": "^3.0.0-alpha.
|
|
34
|
-
"@midwayjs/logger": "^2.
|
|
33
|
+
"@midwayjs/core": "^3.0.0-alpha.37+574e016e",
|
|
34
|
+
"@midwayjs/logger": "^2.13.0",
|
|
35
35
|
"socket.io": "^4.0.0",
|
|
36
36
|
"socket.io-redis": "^6.1.0"
|
|
37
37
|
},
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"type": "git",
|
|
41
41
|
"url": "http://github.com/midwayjs/midway.git"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "574e016e6bdc4be94f2ee8f82ada1670011911f1"
|
|
44
44
|
}
|