Skip to content

Commit 37f8a32

Browse files
fix(cluster-engine): properly export options
1 parent f5445f0 commit 37f8a32

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

packages/socket.io-cluster-engine/lib/cluster.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import cluster from "node:cluster";
22
import { type ServerOptions } from "engine.io";
3-
import { ClusterEngine, type Message } from "./engine";
3+
import { ClusterEngine, ClusterEngineOptions, type Message } from "./engine";
44
import debugModule from "debug";
55

66
const debug = debugModule("engine:cluster");
@@ -42,7 +42,7 @@ export function setupPrimary() {
4242
}
4343

4444
export class NodeClusterEngine extends ClusterEngine {
45-
constructor(opts?: ServerOptions) {
45+
constructor(opts?: ServerOptions & ClusterEngineOptions) {
4646
super(opts);
4747

4848
process.on("message", (message: Message & { _source?: string }) => {

packages/socket.io-cluster-engine/lib/engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function isValidSessionId(str: string) {
141141
return typeof str === "string" && str.length === 20;
142142
}
143143

144-
interface ClusterEngineOptions {
144+
export interface ClusterEngineOptions {
145145
/**
146146
* The maximum waiting time for responses from other nodes, in ms.
147147
*
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { setupPrimary, NodeClusterEngine } from "./cluster";
22
export { setupPrimaryWithRedis, RedisEngine } from "./redis";
3+
export { type ClusterEngineOptions } from "./engine";

packages/socket.io-cluster-engine/lib/redis.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ClusterEngine, type Message } from "./engine";
1+
import { ClusterEngine, ClusterEngineOptions, type Message } from "./engine";
22
import { encode, decode } from "@msgpack/msgpack";
33
import { type ServerOptions } from "engine.io";
44
import cluster from "node:cluster";
@@ -134,7 +134,11 @@ export class RedisEngine extends ClusterEngine {
134134
private readonly _pubClient: any;
135135
private readonly _channelPrefix: string;
136136

137-
constructor(pubClient: any, subClient: any, opts?: RedisEngineOptions) {
137+
constructor(
138+
pubClient: any,
139+
subClient: any,
140+
opts?: RedisEngineOptions & ClusterEngineOptions,
141+
) {
138142
super(opts);
139143
this._pubClient = pubClient;
140144
this._channelPrefix = opts?.channelPrefix || "engine.io";

0 commit comments

Comments
 (0)