Skip to content

Commit 0d2d69c

Browse files
fix(typings): properly expose the createAdapter method
1 parent 3334d99 commit 0d2d69c

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

lib/index.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Adapter, BroadcastOptions, Room, SocketId } from "socket.io-adapter";
55

66
const debug = require("debug")("socket.io-redis");
77

8+
module.exports = exports = createAdapter;
9+
810
/**
911
* Request types, for messages between nodes
1012
*/
@@ -27,9 +29,23 @@ interface Request {
2729
}
2830

2931
export interface RedisAdapterOptions {
32+
/**
33+
* the name of the key to pub/sub events on as prefix
34+
* @default socket.io
35+
*/
3036
key: string;
37+
/**
38+
* the redis client to publish events on
39+
*/
3140
pubClient: any;
41+
/**
42+
* the redis client to subscribe to events on
43+
*/
3244
subClient: any;
45+
/**
46+
* after this timeout the adapter will stop waiting from responses to request
47+
* @default 5000
48+
*/
3349
requestsTimeout: number;
3450
}
3551

@@ -52,8 +68,9 @@ function createRedisClient(uri, opts) {
5268
* @public
5369
*/
5470
export function createAdapter(uri: string, opts?: Partial<RedisAdapterOptions>);
71+
export function createAdapter(opts: Partial<RedisAdapterOptions>);
5572
export function createAdapter(
56-
uri?: string,
73+
uri?: any,
5774
opts: Partial<RedisAdapterOptions> = {}
5875
) {
5976
// handle options only
@@ -606,5 +623,3 @@ export class RedisAdapter extends Adapter {
606623
}
607624
}
608625
}
609-
610-
module.exports = createAdapter;

0 commit comments

Comments
 (0)