About data when using Presence API

Re: Join rooms sharing auth

Hi, I read the thread but I'm unsure about what I understand.
If we set data on Redis using:
roomInstance.presence.hset(...)
Will the data be lost when the Room is disposed?
I think the data should be there until we manually delete it right?

If the data is lost when the Room is disposed, but I want the cached data to be still available, should I create a stand alone Redis client, and use the raw Redis API to cache data?
Please suggest... Any help is much appreciated! 😃

Hi, @itoonom, welcome!

If you're using Visual Studio Code, you can Right click + Go to definition (F12) on the RedisPresence, and redis.ClientOpts, which you'll see all accepted config values for RedisPresence constructor, which are:

export interface ClientOpts {
    host?: string;
    port?: number;
    path?: string;
    url?: string;
    parser?: string;
    string_numbers?: boolean;
    return_buffers?: boolean;
    detect_buffers?: boolean;
    socket_keepalive?: boolean;
    no_ready_check?: boolean;
    enable_offline_queue?: boolean;
    retry_max_delay?: number;
    connect_timeout?: number;
    max_attempts?: number;
    retry_unfulfilled_commands?: boolean;
    auth_pass?: string;
    password?: string;
    db?: string | number;
    family?: string;
    rename_commands?: { [command: string]: string } | null;
    tls?: any;
    prefix?: string;
    retry_strategy?: RetryStrategy;
}

You should pass a plain JavaScript object BTW, no need to call new ClientOpts. Example:

new colyseus.RedisPresence({
    // your Redis configs here
});

The data stored via the presence API is not disposed automatically. It's up to you when to remove them.

@endel
Thank you very much.
Your help gives me more confidence to keep going on. The scaling topic is all new to me, so every single explanation/example counts!