Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nothing work #552

Open
aishmurodov opened this issue Oct 18, 2024 · 0 comments
Open

Nothing work #552

aishmurodov opened this issue Oct 18, 2024 · 0 comments

Comments

@aishmurodov
Copy link

aishmurodov commented Oct 18, 2024

Hello, I created the adapter and connection, but nothing work

I have two same servers that balanced with proxy.
I use fastify and fastify-socket.io

My code below

    const pubClient = createClient({
      url: 'redis://${encodeURIComponent(config.redis.user)}:${encodeURIComponent(config.redis.password)}@${config.redis.host}:${config.redis.port}',
    });

    const subClient = pubClient.duplicate();

    pubClient.on("ready", () => {
      logging.info("pubClient is ready");
    });
    subClient.on("ready", () => {
      logging.info("subClient is ready");
    });

    await Promise.all([
      pubClient.connect(),
      subClient.connect(),
    ])

    FastifyServer.register(FastifyIO, {
      adapter: createAdapter(pubClient, subClient),
      cors: {
        origin: (
          requestOrigin: string | undefined,
          callback: (err: Error | null, origin?: boolean) => void
        ) => {
          callback(null, true);
        },
        credentials: true,
        methods: ["PUT", "POST", "PATCH", "DELETE", "GET"],
      },
    });

Connection is ok, i am getting "pubClient is ready" and "subClient is ready"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant