@hastehaul/common 2.0.28 → 2.0.29

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
- this._redisClient = new ioredis_1.default({ host: host || this.host, port: port || this.port, maxRetriesPerRequest: null });
48
- this._redisClient.on("connect", function () {
49
- console.info("Redis Server Connected!");
50
- });
51
- this._redisClient.on("error", function (error) {
52
- console.error("Error in Redis", error);
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,25 @@ class SocketWrapper {
35
35
  */
36
36
  connect(httpServer, path) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
- this._io = new socket_io_1.Server(httpServer, {
39
- path: `/${path ? path + '/' : ''}socket/`,
40
- pingTimeout: 30000,
41
- pingInterval: 25000,
42
- cors: {
43
- origin: "*",
44
- methods: ["GET", "POST"],
45
- // credentials: true,
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
+ this._io.on("connect", () => {
50
+ console.info("Socket.io Server Connected!");
51
+ resolve();
52
+ });
53
+ this._io.on("error", (error) => {
54
+ console.error("Error in Socket.io", error);
55
+ reject(error);
56
+ });
47
57
  });
48
58
  });
49
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastehaul/common",
3
- "version": "2.0.28",
3
+ "version": "2.0.29",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",