@hastehaul/common 2.0.28 → 2.0.30
Sign up to get free protection for your applications and to get access to all the features.
@@ -44,12 +44,16 @@ class RedisWrapper {
|
|
44
44
|
*/
|
45
45
|
connect(host, port) {
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
return new Promise((resolve, reject) => {
|
48
|
+
this._redisClient = new ioredis_1.default({ host: host || this.host, port: port || this.port, maxRetriesPerRequest: null });
|
49
|
+
this._redisClient.on("connect", () => {
|
50
|
+
console.info("Redis Server Connected!");
|
51
|
+
resolve();
|
52
|
+
});
|
53
|
+
this._redisClient.on("error", (error) => {
|
54
|
+
console.error("Error in Redis", error);
|
55
|
+
reject(error);
|
56
|
+
});
|
53
57
|
});
|
54
58
|
});
|
55
59
|
}
|
@@ -35,15 +35,18 @@ class SocketWrapper {
|
|
35
35
|
*/
|
36
36
|
connect(httpServer, path) {
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
38
|
+
return new Promise((resolve, reject) => {
|
39
|
+
this._io = new socket_io_1.Server(httpServer, {
|
40
|
+
path: `/${path ? path + '/' : ''}socket/`,
|
41
|
+
pingTimeout: 30000,
|
42
|
+
pingInterval: 25000,
|
43
|
+
cors: {
|
44
|
+
origin: "*",
|
45
|
+
methods: ["GET", "POST"],
|
46
|
+
// credentials: true,
|
47
|
+
},
|
48
|
+
});
|
49
|
+
resolve();
|
47
50
|
});
|
48
51
|
});
|
49
52
|
}
|