Skip to content

listHandles only works on a session you created #18

@sampierson

Description

@sampierson

I'm building a tool to interrogate our Janus servers and build a graph of who is connected to whom.
Part of this process is to list all sessions then list their handles.

I can do this with direct http calls, but I cannot do it with janode. If I try to list handles for a session I did not create, Connection._handleMessage complains that: "session xxxxxxxxxxxx not found for incoming message success".
Here: https://github.com/meetecho/janode/blob/master/src/connection.js#L194

It seems that Connection keeps a cache of sessions so the right session can handle responses. But this is an admin function that takes a session parameter, and does not require one to establish a session first.

Here is some code to demonstrate the issue:

import Janode from 'janode';

const connection = await Janode.connect({
  is_admin: true,
  address: {
    url: "ws://127.0.0.1:7188/janus",
    apisecret: "janusoverlord"
  }
});

const r1 = await connection.listSessions();
console.log("Got sessions response", r1.sessions)
const r2 = await connection.listHandles(r1.sessions[0]);
console.log("Got handles response", handles);

connection.close();

I'm using a Janus with admin enabled on the websocket, and a videoroom call underway.

Here is the output:

2022-11-05T03:58:42.018Z - INFO : [janode.js] creating new connection
2022-11-05T03:58:42.021Z - INFO : [tmanager.js] [3340554914002515] creating new transaction manager (debug=false)
2022-11-05T03:58:42.021Z - INFO : [transport-ws.js] [3340554914002516] trying connection with ws://127.0.0.1:7188/janus
2022-11-05T03:58:42.032Z - INFO : [transport-ws.js] [3340554914002516] websocket connected
2022-11-05T03:58:42.032Z - INFO : [transport-ws.js] [3340554914002516] websocket ping task scheduled every 10 seconds
Got sessions response [ 5013312951136826, 353991153114233 ]
2022-11-05T03:58:42.035Z - INFO : [connection.js] [3340554914002516] requesting handle list
2022-11-05T03:58:42.036Z - WARN : [connection.js] [3340554914002516] session 5013312951136826 not found for incoming message success

I'm using janode version 1.6.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions