Can't forceDisconnect from my server

We having problem using the forceDisconnect method in a session on our server,
session.forceDisconnect(connection)
We can disconnect from our react native app, but we want to control it from our server.
We try to call the Session.activeConnections, but it always an empty array,
So we can’t force disconnect a connection from our server.

what should we do?

Are you using openvidu-node-client or openvidu-java-client? If so, you are getting an empty activeConnections array because you didn’t fetch information from openvidu-server. The documentation is your friend:

https://docs.openvidu.io/en/2.15.0/api/openvidu-node-client/classes/session.html#forcedisconnect

You must call Session.fetch() to bring the current active status for the session and update the attributes of your Session object. If there’s any active connection in the session, after calling Session.fetch your activeConnections array will have the proper values.

Remember Session.fetch is an asynchronous method. Subscribe to its response to know when the Session object has been updated (the promise is resolved to true if it has changed in any property or sub-property, and to false if the object has not changed at all).

Well i tried it before, and it didn’t work, because i forgot to remove
the mySession.disconnect() from my react-native app.
I now removed it,
Works fine!! Thanks a lot!