File tree Expand file tree Collapse file tree
packages/socket.io-cluster-engine/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import cluster from "node:cluster" ;
22import { type ServerOptions } from "engine.io" ;
3- import { ClusterEngine , type Message } from "./engine" ;
3+ import { ClusterEngine , ClusterEngineOptions , type Message } from "./engine" ;
44import debugModule from "debug" ;
55
66const debug = debugModule ( "engine:cluster" ) ;
@@ -42,7 +42,7 @@ export function setupPrimary() {
4242}
4343
4444export 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 } ) => {
Original file line number Diff line number Diff 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 *
Original file line number Diff line number Diff line change 11export { setupPrimary , NodeClusterEngine } from "./cluster" ;
22export { setupPrimaryWithRedis , RedisEngine } from "./redis" ;
3+ export { type ClusterEngineOptions } from "./engine" ;
Original file line number Diff line number Diff line change 1- import { ClusterEngine , type Message } from "./engine" ;
1+ import { ClusterEngine , ClusterEngineOptions , type Message } from "./engine" ;
22import { encode , decode } from "@msgpack/msgpack" ;
33import { type ServerOptions } from "engine.io" ;
44import 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" ;
You can’t perform that action at this time.
0 commit comments