@hastehaul/common 3.13.0 → 4.0.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.
@@ -1,5 +1,5 @@
1
1
  import http from "http";
2
- import { Server } from 'socket.io';
2
+ import { Server, ServerOptions } from 'socket.io';
3
3
  /**
4
4
  * A wrapper class for the Socket.IO server to manage connections and provide a centralized server instance.
5
5
  */
@@ -19,7 +19,7 @@ export declare class SocketWrapper {
19
19
  *
20
20
  * @param {http.Server} httpServer - The HTTP server instance to attach Socket.IO to.
21
21
  */
22
- connect(httpServer: http.Server, path?: string, adapter?: any): Promise<void>;
22
+ connect(httpServer: http.Server, opts?: Partial<ServerOptions>): Promise<void>;
23
23
  }
24
24
  /**
25
25
  * Singleton instance of the SocketWrapper class to provide a centralized Socket.IO server connection.
@@ -33,20 +33,10 @@ class SocketWrapper {
33
33
  *
34
34
  * @param {http.Server} httpServer - The HTTP server instance to attach Socket.IO to.
35
35
  */
36
- connect(httpServer, path, adapter) {
36
+ connect(httpServer, opts) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
38
  return new Promise((resolve, reject) => {
39
- this._io = new socket_io_1.Server(httpServer, {
40
- adapter: adapter,
41
- path: `/${path ? path + '/' : ''}socket/`,
42
- pingTimeout: 30000,
43
- pingInterval: 25000,
44
- cors: {
45
- origin: "*",
46
- methods: ["GET", "POST"],
47
- // credentials: true,
48
- },
49
- });
39
+ this._io = new socket_io_1.Server(httpServer, opts);
50
40
  resolve();
51
41
  });
52
42
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastehaul/common",
3
- "version": "3.13.0",
3
+ "version": "4.0.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",