Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Connection timeout behavior #35

Description

@rafaferry

Hello guys

I've been using this lib for a while, and I've noticed that when there isn't a session active, the client keeps disconnecting and reconnecting. Inspecting through the source code, I understood that this behaviour is intended, and i want to know why.

my code looks like this:

const client = new JanusClient({
      url: janus.url,
      apiSecret: janus.apiSecret,
      reconnect: true,
      connectionTimeout: 50000,
    });

this connectionTimeout parameter is exactly the time that it takes to the client to trigger an disconnected and connected (due to the reconnect:true).

Inspecting the source code, I saw that when a session is active, it sends a keepAlive at 30 seconds interval, and any message sent to janus resets the connectionTimeout, so the client stays connected.

So i'm asking, why this connection timeout exists? This is something to assure websocket stability/reliability by Recreating the connection every 50 seconds without traffic?

edit: if this is the reason, is it still necessary? janus websockets transport has a parameter called pingpong_trigger that i think is to keep the websocket alive.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions