diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..df35b63 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,10 @@ +/// +import { Server as HttpServer } from "http"; +import { Server } from "socket.io"; + +interface Options { + loadBalancingMethod?: "random" | "round-robin" | "least-connection"; +} + +export declare function setupMaster(httpServer: HttpServer, opts?: Options): void; +export declare function setupWorker(io: Server): void; diff --git a/package.json b/package.json index bf75496..17c6a5d 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,15 @@ "version": "1.0.1", "description": "An alternative to the sticky-session package (https://github.com/indutny/sticky-session)", "main": "index.js", + "types": "index.d.ts", "scripts": { "format:check": "prettier --check \"index.js\" \"test/**/*.js\"", "format:fix": "prettier --write \"index.js\" \"test/**/*.js\"", "test": "npm run format:check && nyc mocha --timeout 5000" }, "files": [ - "index.js" + "index.js", + "index.d.ts" ], "author": "Damien Arrachequesne ", "license": "MIT",