{ // skip certificate hostname validation return undefined; }, } } const main = async () => { console.log("Try to connect") const pubClient = new Redis.Cluster([redisConf], { redisOptions: { password: redisPassword }, scaleReads: 'all' }); const subClient = pubClient.duplicate(); const adapter = createAdapter(pubClient, subClient); //await pubClient.connect() }; main()"> { // skip certificate hostname validation return undefined; }, } } const main = async () => { console.log("Try to connect") const pubClient = new Redis.Cluster([redisConf], { redisOptions: { password: redisPassword }, scaleReads: 'all' }); const subClient = pubClient.duplicate(); const adapter = createAdapter(pubClient, subClient); //await pubClient.connect() }; main()"> { // skip certificate hostname validation return undefined; }, } } const main = async () => { console.log("Try to connect") const pubClient = new Redis.Cluster([redisConf], { redisOptions: { password: redisPassword }, scaleReads: 'all' }); const subClient = pubClient.duplicate(); const adapter = createAdapter(pubClient, subClient); //await pubClient.connect() }; main()">
const Redis = require('ioredis');
const { readFileSync } = require('fs');
const { createAdapter } = require('@socket.io/redis-adapter');

const redisHost = "xx.xx.xx.xx" # Example : 192.168.0.13
const redisPort = 6379
const redisUser = "XXXXXXXXXXX"
const redisPassword = "XXXXXXXXXXX"

const redisConf = {
  host: redisHost,
  port: redisPort,
  username: redisUser,
  password: redisPassword,
  connectionTimeout: 5000,
  maxRetriesPerRequest: 3,
  tls: {
    ca: readFileSync("/opt/redis_certificate.pem"),
    checkServerIdentity: (servername, cert) => {
      // skip certificate hostname validation
      return undefined;
    },
  }
} 

const main = async () => {
  console.log("Try to connect")
  const pubClient = new Redis.Cluster([redisConf], {
    redisOptions: {         
      password: redisPassword
    },
    scaleReads: 'all'
  });
  const subClient = pubClient.duplicate();

  const adapter = createAdapter(pubClient, subClient);
  //await pubClient.connect()
};

main()