MCPcopy
hub / github.com/socketio/socket.io / initRedisClient

Function initRedisClient

packages/socket.io-redis-streams-emitter/test/util.ts:30–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28console.log(`[INFO] testing in ${mode} mode with ${lib}`);
29
30export async function initRedisClient() {
31 if (mode === "cluster") {
32 if (lib === "ioredis") {
33 return new Cluster([
34 {
35 host: "localhost",
36 port: 7000,
37 },
38 {
39 host: "localhost",
40 port: 7001,
41 },
42 {
43 host: "localhost",
44 port: 7002,
45 },
46 {
47 host: "localhost",
48 port: 7003,
49 },
50 {
51 host: "localhost",
52 port: 7004,
53 },
54 {
55 host: "localhost",
56 port: 7005,
57 },
58 ]);
59 } else {
60 const redisClient = createCluster({
61 rootNodes: [
62 {
63 url: "redis://localhost:7000",
64 },
65 {
66 url: "redis://localhost:7001",
67 },
68 {
69 url: "redis://localhost:7002",
70 },
71 {
72 url: "redis://localhost:7003",
73 },
74 {
75 url: "redis://localhost:7004",
76 },
77 {
78 url: "redis://localhost:7005",
79 },
80 ],
81 });
82
83 await redisClient.connect();
84
85 return redisClient;
86 }
87 } else {

Callers 2

index.tsFile · 0.90
initFunction · 0.85

Calls 2

createClientFunction · 0.85
connectMethod · 0.45

Tested by

no test coverage detected