RBWCM-SDK Documentation - v1.1.0
    Preparing search index...

    Class RequestHandler

    Handles synchronous request/response (RPC) communication via Redis Pub/Sub. Automatically manages correlation IDs, timeouts, subscription lifecycle, and error routing. *

    const handler = new RequestHandler();
    await handler.initialize(redisClient);

    // Send a request to another microservice
    const response = await handler.send(
    RankedRequest.RequestVoiceStateSync,
    { channelIds: ["123"] },
    publisherRedis
    );

    // Listen for incoming requests
    await handler.onRequest(
    RankedRequest.RequestVoiceStateSync,
    async (payload) => {
    return { success: true };
    }
    );
    Index

    Constructors

    Methods

    • Gracefully terminates all pending requests and releases Redis subscriptions. Recommended during application teardown to prevent memory leaks.

      Returns Promise<void>

    • Mounts the active Redis connection to listen for incoming requests and responses. Must be called prior to sending or receiving any RPC. *

      Parameters

      • responseRedis: Redis

        The Redis client dedicated to Pub/Sub subscriptions.

      • publisherRedis: Redis

      Returns void